From: Tim Otten Date: Tue, 5 Dec 2023 22:20:27 +0000 (+0000) Subject: standaloneusers - Fix tokens+docblocks for password-reset email X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cf6290f1bba262e57d139c57c0e83da1cdc3bdc0;p=civicrm-core.git standaloneusers - Fix tokens+docblocks for password-reset email --- diff --git a/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php b/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php index 3797232262..76f45c5d24 100644 --- a/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php +++ b/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php @@ -3,10 +3,10 @@ use Civi\WorkflowMessage\GenericWorkflowMessage; /** * - * @method static setResetUrlPlaintext(string $s) - * @method static setResetUrlHtml(string $s) - * @method static setUsernamePlaintext(string $s) - * @method static setUsernameHtml(string $s) + * @method $this setResetUrlPlaintext(string $s) + * @method $this setResetUrlHtml(string $s) + * @method $this setUsernamePlaintext(string $s) + * @method $this setUsernameHtml(string $s) * */ class CRM_Standaloneusers_WorkflowMessage_PasswordReset extends GenericWorkflowMessage { @@ -62,6 +62,7 @@ class CRM_Standaloneusers_WorkflowMessage_PasswordReset extends GenericWorkflowM $resetUrlHtml = htmlspecialchars($resetUrlPlaintext); $this->logParams = [ 'userID' => $user['id'], + 'contactID' => $user['contact_id'], 'username' => $user['username'], 'email' => $user['uf_name'], 'url' => $resetUrlPlaintext, @@ -71,7 +72,8 @@ class CRM_Standaloneusers_WorkflowMessage_PasswordReset extends GenericWorkflowM ->setResetUrlHtml($resetUrlHtml) ->setUsernamePlaintext($user['username']) ->setUsernameHtml(htmlspecialchars($user['username'])) - ->setTo($user['uf_name']); + ->setTo(['name' => $user['username'], 'email' => $user['uf_name']]) + ->setContactID($user['contact_id']); return $this; } diff --git a/ext/standaloneusers/Civi/Api4/Action/User/SendPasswordReset.php b/ext/standaloneusers/Civi/Api4/Action/User/SendPasswordReset.php index 6205d79078..54f99a76fa 100644 --- a/ext/standaloneusers/Civi/Api4/Action/User/SendPasswordReset.php +++ b/ext/standaloneusers/Civi/Api4/Action/User/SendPasswordReset.php @@ -41,7 +41,7 @@ class SendPasswordReset extends AbstractAction { } $user = User::get(FALSE) - ->addSelect('id', 'uf_name', 'username') + ->addSelect('id', 'uf_name', 'username', 'contact_id') ->addWhere('is_active', '=', TRUE) ->setLimit(1) ->addWhere(