Jelajahi Sumber

Ticket #5365 - Improve activation/confirmation/welcome letters sending.

AntonLV 6 bulan lalu
induk
melakukan
d87fa30778

+ 5 - 2
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -208,10 +208,13 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
          */
         $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
 
-        // approve profile if auto-approval is enabled and profile status is 'pending'
+        /* 
+         * approve profile if auto-approval is enabled and profile status is 'pending'
+         * don't send Activation letter when 'Auto Approval' mode is enabled.
+         */
         $sStatus = $oProfile->getStatus();
         if ($sStatus == BX_PROFILE_STATUS_PENDING && $this->isAutoApproval(BX_DOL_PROFILE_ACTIVATE_ADD))
-            $oProfile->approve(BX_PROFILE_ACTION_AUTO, 0, $this->_oModule->serviceActAsProfile() && $this->_oModule->serviceIsEnableProfileActivationLetter());
+            $oProfile->approve(BX_PROFILE_ACTION_AUTO, 0, false);
 
         // set created profile some default membership
         if ((int)bx_get('level_id') && bx_srv('bx_acl', 'get_prices', [(int)bx_get('level_id'), true]))

+ 3 - 3
modules/base/profile/classes/BxBaseModProfileGridAdministration.php

@@ -218,14 +218,14 @@ class BxBaseModProfileGridAdministration extends BxBaseModGeneralGridAdministrat
 
     protected function _enable ($mixedId, $isChecked)
     {
-    	$oProfile = $this->_getProfileObject($mixedId);
+        $oProfile = $this->_getProfileObject($mixedId);
 
-    	if($oProfile instanceof BxDolProfileUndefined)
+        if($oProfile instanceof BxDolProfileUndefined)
             return false;
 
         $iAction = BX_PROFILE_ACTION_MANUAL;
         $bSendEmailNotification = $this->_oModule->serviceActAsProfile();
-    	return $isChecked ? $oProfile->activate($iAction, 0, $bSendEmailNotification) : $oProfile->suspend($iAction, 0, $bSendEmailNotification);
+        return $isChecked ? $oProfile->activate($iAction, 0, $bSendEmailNotification && $this->_oModule->serviceIsEnableProfileActivationLetter()) : $oProfile->suspend($iAction, 0, $bSendEmailNotification);
     }
 
     protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)