public function onDataAddAfter($iAccountId, $iContentId) { if ($s = parent::onDataAddAfter($iAccountId, $iContentId)) { return $s; } $CNF =& $this->_oModule->_oConfig->CNF; // add account and content association $iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, $iAccountId, $iContentId, BX_PROFILE_STATUS_PENDING, $this->_oModule->getName()); $oProfile = BxDolProfile::getInstance($iProfileId); // approve profile if auto-approval is enabled and profile status is 'pending' $sStatus = $oProfile->getStatus(); if ($sStatus == BX_PROFILE_STATUS_PENDING && $this->isAutoApproval()) { $oProfile->approve(BX_PROFILE_ACTION_AUTO); } // set created profile some default membership $iAclLevel = isAdmin() ? MEMBERSHIP_ID_ADMINISTRATOR : getParam($CNF['PARAM_DEFAULT_ACL_LEVEL']); BxDolAcl::getInstance()->setMembership($iProfileId, $iAclLevel, 0, true); // alert bx_alert($this->_oModule->getName(), 'added', $iContentId); // switch context to the created profile $oAccount = BxDolAccount::getInstance($iAccountId); $oAccount->updateProfileContext($iProfileId); return ''; }
public function onDataAddAfter($iAccountId, $iContentId) { if ($s = parent::onDataAddAfter($iAccountId, $iContentId)) { return $s; } $CNF =& $this->_oModule->_oConfig->CNF; if (!($aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId))) { return MsgBox(_t('_sys_txt_error_occured')); } // alert $aParams = array('object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]); if (isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']])) { $aParams['privacy_view'] = $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]; } bx_alert($this->_oModule->getName(), 'added', $iContentId, false, $aParams); return ''; }