Ver Fonte

#3272 Mailchimp and *Connect Modules

Alex Trofimov há 5 anos atrás
pai
commit
1b7f3bbaf5

+ 4 - 1
inc/classes/BxDolAcl.php

@@ -581,8 +581,10 @@ class BxDolAcl extends BxDolFactory implements iBxDolSingleton
 
 
             // delete present and future memberships
             // delete present and future memberships
             $bResult = $this->oDb->deleteLevelByProfileId($iProfileId);
             $bResult = $this->oDb->deleteLevelByProfileId($iProfileId);
-            if($bResult)
+            if($bResult) {
                 $this->oDb->cleanMemory('BxDolAclQuery::getLevelCurrent' . $iProfileId . time());
                 $this->oDb->cleanMemory('BxDolAclQuery::getLevelCurrent' . $iProfileId . time());
+                unset(self::$_aCacheData[$iProfileId . '_0']);
+            }
 
 
             return $bResult;
             return $bResult;
         }
         }
@@ -600,6 +602,7 @@ class BxDolAcl extends BxDolFactory implements iBxDolSingleton
             $this->oDb->deleteLevelByProfileId($iProfileId, true); 
             $this->oDb->deleteLevelByProfileId($iProfileId, true); 
             $this->oDb->clearActionsTracksForMember($iProfileId);
             $this->oDb->clearActionsTracksForMember($iProfileId);
             $this->oDb->cleanMemory('BxDolAclQuery::getLevelCurrent' . $iProfileId . time());
             $this->oDb->cleanMemory('BxDolAclQuery::getLevelCurrent' . $iProfileId . time());
+            unset(self::$_aCacheData[$iProfileId . '_0']);
         }
         }
         else
         else
             $iDateStarts = $aMembershipLatest['date_expires'];
             $iDateStarts = $aMembershipLatest['date_expires'];

+ 2 - 2
inc/classes/BxDolProfile.php

@@ -427,7 +427,7 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
 
 
         // create system event before deletion
         // create system event before deletion
         $isStopDeletion = false;
         $isStopDeletion = false;
-        bx_alert('profile', 'before_delete', $ID, 0, array('delete_with_content' => $bDeleteWithContent, 'stop_deletion' => &$isStopDeletion));
+        bx_alert('profile', 'before_delete', $ID, 0, array('delete_with_content' => $bDeleteWithContent, 'stop_deletion' => &$isStopDeletion, 'type' => $aProfileInfo['type']));
         if ($isStopDeletion)
         if ($isStopDeletion)
             return false;
             return false;
 
 
@@ -459,7 +459,7 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
             return false;
             return false;
 
 
         // create system event
         // create system event
-        bx_alert('profile', 'delete', $ID, 0, array('delete_with_content' => $bDeleteWithContent));
+        bx_alert('profile', 'delete', $ID, 0, array('delete_with_content' => $bDeleteWithContent, 'type' => $aProfileInfo['type']));
 
 
         // unset class instance to prevent creating the instance again
         // unset class instance to prevent creating the instance again
         $this->_iProfileID = 0;
         $this->_iProfileID = 0;

+ 4 - 1
modules/base/connect/classes/BxBaseModConnectModule.php

@@ -185,7 +185,6 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
 
 
             // create account
             // create account
             $aFieldsAccount['password'] = genRndPwd();
             $aFieldsAccount['password'] = genRndPwd();
-            $aFieldsAccount['email_confirmed'] = $this->_oConfig->isAlwaysConfirmEmail; 
             if (!($iAccountId = $oFormAccount->insert($aFieldsAccount)))
             if (!($iAccountId = $oFormAccount->insert($aFieldsAccount)))
                 return _t('_sys_txt_error_account_creation');
                 return _t('_sys_txt_error_account_creation');
 
 
@@ -212,6 +211,10 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
                 $iProfileId = $iAccountProfileId;
                 $iProfileId = $iAccountProfileId;
             }
             }
 
 
+            $oAccount = BxDolAccount::getInstance();
+            if ($oAccount)
+                $oAccount->updateEmailConfirmed($this->_oConfig->isAlwaysConfirmEmail);
+
             // send email with password
             // send email with password
             sendMailTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iAccountId, $iProfileId, array('password' => $aFieldsAccount['password']), BX_EMAIL_SYSTEM);
             sendMailTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iAccountId, $iProfileId, array('password' => $aFieldsAccount['password']), BX_EMAIL_SYSTEM);
         }
         }

+ 4 - 1
modules/boonex/mailchimp/classes/BxMailchimpAlerts.php

@@ -37,7 +37,10 @@ class BxMailchimpAlerts extends BxDolAlertsResponse
             $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
             $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
             
             
             if ($oAccount)
             if ($oAccount)
-                $this->_oModule->serviceUpdateAccount($oAccount->id());
+                if ('delete' == $o->sAction && isset($o->aExtras['type']) && 'system' == $o->aExtras['type'])
+                    $this->_oModule->serviceRemoveAccount($oAccount->id());
+                else
+                    $this->_oModule->serviceUpdateAccount($oAccount->id());
         }
         }
     }    
     }    
 }
 }

+ 1 - 1
modules/boonex/mailchimp/classes/BxMailchimpModule.php

@@ -66,7 +66,7 @@ class BxMailchimpModule extends BxDolModule
 
 
         $aRet = array();
         $aRet = array();
         foreach ($a['lists'] as $r)
         foreach ($a['lists'] as $r)
-            $aRet[$r['id']] = $r['name'];
+            $aRet[] = array('key' => $r['id'], 'value' => $r['name']);
 
 
         if ($bAddEmptyValue)
         if ($bAddEmptyValue)
             array_unshift($aRet, _t('_sys_please_select'));
             array_unshift($aRet, _t('_sys_please_select'));

+ 1 - 1
template/scripts/BxBaseFormAccount.php

@@ -161,7 +161,7 @@ class BxBaseFormAccount extends BxTemplFormView
         $bResult = parent::update ($val, $aValsToAdd, $aTrackTextFieldsChanges);
         $bResult = parent::update ($val, $aValsToAdd, $aTrackTextFieldsChanges);
         
         
         if ($bResult){
         if ($bResult){
-            $oAccount = BxDolAccount::getInstance($val);
+            $oAccount = BxDolAccount::getInstance($val, true);
             if ($oAccount) { 
             if ($oAccount) { 
                 $aAccountInfo = $oAccount->getInfo();
                 $aAccountInfo = $oAccount->getInfo();
                 bx_alert('account', 'change_receive_news', 0, false, array('account_id' => $val, 'old_value' => $aAccountInfo['receive_news'], 'new_value' => $this->getCleanValue('receive_news'), 'email' => $aAccountInfo['email']));
                 bx_alert('account', 'change_receive_news', 0, false, array('account_id' => $val, 'old_value' => $aAccountInfo['receive_news'], 'new_value' => $this->getCleanValue('receive_news'), 'email' => $aAccountInfo['email']));