standaloneusers - Fix tokens+docblocks for password-reset email
authorTim Otten <totten@civicrm.org>
Tue, 5 Dec 2023 22:20:27 +0000 (22:20 +0000)
committerTim Otten <totten@civicrm.org>
Wed, 6 Dec 2023 11:02:51 +0000 (11:02 +0000)
ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php
ext/standaloneusers/Civi/Api4/Action/User/SendPasswordReset.php

index 3797232262d427538b3434bf999c165fe42a6d83..76f45c5d2412cee88368c6bd7e802d51dd086a97 100644 (file)
@@ -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;
   }
 
index 6205d79078c0abad418d04c3908f88eb5df6e470..54f99a76fa77ec994f27da9917ebaa7e09da25fa 100644 (file)
@@ -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(