From 7aa006af6bdeb9118da969d7026e17cc32d98ca6 Mon Sep 17 00:00:00 2001 From: JediKev Date: Thu, 17 May 2018 14:57:28 -0500 Subject: [PATCH] issue: User Registration CLI This addresses an issue on the forums where the User Registration CLI was referencing a nonexistent function therefore breaking when ran. This updates the code to point to the correct function and includes the correct `$vars` necessary for User Registration. --- include/cli/modules/user.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/cli/modules/user.php b/include/cli/modules/user.php index 00dd6af..14576fa 100644 --- a/include/cli/modules/user.php +++ b/include/cli/modules/user.php @@ -86,6 +86,10 @@ class UserManager extends Module { break; case 'activate': + global $ost, $cfg; + $ost = osTicket::start(); + $cfg = $ost->getConfig(); + $users = $this->getQuerySet($options); foreach ($users as $U) { if ($options['verbose']) { @@ -95,16 +99,18 @@ class UserManager extends Module { )); } if (!($account = $U->getAccount())) { - $account = UserAccount::create(array('user' => $U)); - $U->account = $account; + $errors = array(); + $vars = array( + 'id' => $U->getId(), + 'username' => $U->getEmail(), + 'sendemail' => ($options['send-mail']) ? 1 : 0 + ); + $account = UserAccount::register($U, $vars, $errors); + $U->account = $account->ht->user->ht->account; $U->save(); } if ($options['send-mail']) { - global $ost, $cfg; - $ost = osTicket::start(); - $cfg = $ost->getConfig(); - if (($error = $account->sendConfirmEmail()) && $error !== true) { $this->warn(sprintf('%s: Unable to send email: %s', $U->getDefaultEmail(), $error->getMessage() -- 1.8.3.1