+ /*
+ * Note: creating a group by admin is pretty much the same as self-registration,
+ * except that created_by fields for group and user must be set to admin account.
+ * Therefore, we'll reuse ttRegistrator instance to create a group here
+ * and override created_by fields using ttRegistrator::setCreatedBy() function.
+ */
+
+ // Create fields array for ttRegistrator instance.
+ if (!defined('CURRENCY_DEFAULT')) define('CURRENCY_DEFAULT', '$');
+ $fields = array(
+ 'user_name' => $cl_manager_name,
+ 'login' => $cl_manager_login,
+ 'password1' => $cl_password1,
+ 'password2' => $cl_password2,
+ 'email' => $cl_manager_email,
+ 'group_name' => $cl_team_name,
+ 'currency' => CURRENCY_DEFAULT,
+ 'lang' => $cl_lang);
+
+ // Create an instance of ttRegistrator class.
+ import('ttRegistrator');
+ $registrator = new ttRegistrator($fields, $err);
+ $registrator->register();
+ $registrator->setCreatedBy($user->id); // Override created_by to admin account.