Просмотр исходного кода

#378 Facebook connect: when redirect is set to join form, then facebook account must be associated with real profile, not account profile

Alex Trofimov 10 лет назад
Родитель
Сommit
42ee7fbd91

+ 10 - 8
modules/base/connect/classes/BxBaseModConnectAlerts.php

@@ -25,15 +25,17 @@ class BxBaseModConnectAlerts extends BxDolAlertsResponse
 
                 case 'add':
                     // add remote account and local profile association
-                    bx_import('BxDolSession');
-                    $oSession = BxDolSession::getInstance();
-
-                    $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid);
-                    if ($iRemoteProfileId) {
-                        $oSession->unsetValue($this->oModule->_oConfig->sSessionUid);
-                        $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId);
+                    $oProfile = BxDolProfile::getInstance($o->iObject);
+                    if ($oProfile && 'system' != $oProfile->getModule()) {
+                        bx_import('BxDolSession');
+                        $oSession = BxDolSession::getInstance();
+
+                        $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid);
+                        if ($iRemoteProfileId) {
+                            $oSession->unsetValue($this->oModule->_oConfig->sSessionUid);
+                            $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId);
+                        }
                     }
-
                     break;
 
             }

+ 1 - 0
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -96,6 +96,7 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
 
         // create an alert
         bx_alert($this->_oModule->getName(), 'edited', $aContentInfo[$CNF['FIELD_ID']]);
+        bx_alert('profile', 'edit', $oProfile->id(), 0, array('content' => $iContentId, 'module' => $this->_oModule->getName()));
 
         return '';
     }