AntonLV 6 лет назад
Родитель
Сommit
417c8fae19
1 измененных файлов с 19 добавлено и 8 удалено
  1. 19 8
      inc/classes/BxDolAccount.php

+ 19 - 8
inc/classes/BxDolAccount.php

@@ -326,7 +326,13 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
      */
     public function sendConfirmationEmail($iAccountId = false)
     {
-        $iAccountId = (int)$iAccountId ? (int)$iAccountId : $this->_iAccountID;
+        $iAccountId = (int)$iAccountId;
+        if(!$iAccountId)
+            $iAccountId = $this->_iAccountID;
+
+        $aAccountInfo = $this->getInfo($iAccountId);
+        if(empty($aAccountInfo) || !is_array($aAccountInfo))
+            return false;
 
         $oKey = BxDolKey::getInstance();
         $sConfirmationCode = $oKey->getNewKey(array('account_id' => $iAccountId));
@@ -334,13 +340,13 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
 
         $aReplaceVars = array(
             'name' => $this->getDisplayName($iAccountId),
-            'email' => $this->getEmail($iAccountId),
+            'email' => $aAccountInfo['email'],
             'conf_code' => $sConfirmationCode,
             'conf_link' => $sConfirmationLink,
             'conf_form_link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-email')
         );
 
-        $bResult = sendMailTemplate('t_Confirmation', $iAccountId, 0, $aReplaceVars, BX_EMAIL_SYSTEM);
+        $bResult = sendMailTemplate('t_Confirmation', $iAccountId, (int)$aAccountInfo['profile_id'], $aReplaceVars, BX_EMAIL_SYSTEM);
         if($bResult)
             $this->doAudit($iAccountId, '_sys_audit_action_account_resend_confirmation_email');
 
@@ -349,19 +355,24 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
     
     public function sendResetPasswordEmail($iAccountId = false)
     {
-        $iAccountId = (int)$iAccountId ? (int)$iAccountId : $this->_iAccountID;
+        $iAccountId = (int)$iAccountId;
+        if(!$iAccountId)
+            $iAccountId = $this->_iAccountID;
+
+        $aAccountInfo = $this->getInfo($iAccountId);
+        if(empty($aAccountInfo) || !is_array($aAccountInfo))
+            return false;
 
-        $sEmail = $this->getEmail($iAccountId);
-        $sKey = bx_get_reset_password_key($sEmail);
+        $sKey = bx_get_reset_password_key($aAccountInfo['email']);
 
         $aReplaceVars = array(
             'name' => $this->getDisplayName($iAccountId),
-            'email' => $sEmail,
+            'email' => $aAccountInfo['email'],
             'key' => $sKey,
             'forgot_password_url' => bx_get_reset_password_link_by_key($sKey)
         );
 
-        return sendMailTemplate('t_Forgot', $iAccountId, 0, $aReplaceVars, BX_EMAIL_SYSTEM);
+        return sendMailTemplate('t_Forgot', $iAccountId, (int)$aAccountInfo['profile_id'], $aReplaceVars, BX_EMAIL_SYSTEM);
     }
 
     /**