当前位置: 首页>>代码示例>>PHP>>正文


PHP BxDolProfile::add方法代码示例

本文整理汇总了PHP中BxDolProfile::add方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolProfile::add方法的具体用法?PHP BxDolProfile::add怎么用?PHP BxDolProfile::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BxDolProfile的用法示例。


在下文中一共展示了BxDolProfile::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createAccountForm

 public function createAccountForm()
 {
     // check access
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedCreate(0))) {
         return MsgBox($sMsg);
     }
     // check and display form
     $oForm = BxDolForm::getObjectInstance('sys_account', 'sys_account_create');
     if (!$oForm) {
         return MsgBox(_t('_sys_txt_error_occured'));
     }
     $oForm->initChecker();
     if (!$oForm->isSubmittedAndValid()) {
         $sCode = $oForm->getCode();
         bx_alert('account', 'add_form', 0, 0, array('form_object' => &$oForm, 'form_code' => &$sCode));
         return $sCode;
     }
     // insert data into database
     $aValsToAdd = array('email_confirmed' => 0);
     $iAccountId = $oForm->insert($aValsToAdd);
     if (!$iAccountId) {
         if (!$oForm->isValid()) {
             return $oForm->getCode();
         } else {
             return MsgBox(_t('_sys_txt_error_account_creation'));
         }
     }
     // alert
     bx_alert('account', 'add', $iAccountId, 0);
     // if email_confirmation procedure is enabled - send email confirmation letter
     $oAccount = BxDolAccount::getInstance($iAccountId);
     if (getParam('sys_email_confirmation') && $oAccount && !$oAccount->isConfirmed()) {
         $oAccount->sendConfirmationEmail($iAccountId);
     }
     // add account and content association
     bx_import('BxDolProfile');
     $iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, $iAccountId, $iAccountId, BX_PROFILE_STATUS_PENDING, 'system');
     $oProfile = BxDolProfile::getInstance($iProfileId);
     // approve profile if auto-approval is enabled and profile status is 'pending'
     $sStatus = $oProfile->getStatus();
     $isAutoApprove = $oForm->isSetPendingApproval() ? false : true;
     if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
         $oProfile->approve(BX_PROFILE_ACTION_AUTO);
     }
     // perform action
     BxDolAccount::isAllowedCreate($iProfileId, true);
     // alert
     bx_alert('account', 'added', $iAccountId);
     // login to the created account automatically
     bx_login($iAccountId);
     $this->_iProfileId = bx_get_logged_profile_id();
     // redirect
     $this->_redirectAndExit(getParam('sys_redirect_after_account_added'), true, array('account_id' => $iAccountId, 'profile_id' => $iProfileId));
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:54,代码来源:BxBaseAccountForms.php

示例2: onDataAddAfter

 protected function onDataAddAfter($iContentId)
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     // add account and content association
     $iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, getLoggedId(), $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();
     $isAutoApprove = getParam($CNF['PARAM_AUTOAPPROVAL']) ? true : false;
     if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
         $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();
     $oAccount->updateProfileContext($iProfileId);
     return '';
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:22,代码来源:BxBaseModProfileFormsEntryHelper.php

示例3: onAccountCreated

 public function onAccountCreated($iAccountId, $isSetPendingApproval, $iAction = BX_PROFILE_ACTION_MANUAL)
 {
     // alert
     bx_alert('account', 'add', $iAccountId, 0);
     // if email_confirmation procedure is enabled - send email confirmation letter
     $oAccount = BxDolAccount::getInstance($iAccountId);
     if (getParam('sys_email_confirmation') && $oAccount && !$oAccount->isConfirmed()) {
         $oAccount->sendConfirmationEmail($iAccountId);
     }
     // add account and content association
     $iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, $iAccountId, $iAccountId, BX_PROFILE_STATUS_PENDING, 'system');
     $oProfile = BxDolProfile::getInstance($iProfileId);
     // approve profile if auto-approval is enabled and profile status is 'pending'
     $sStatus = $oProfile->getStatus();
     $isAutoApprove = !$isSetPendingApproval;
     if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
         $oProfile->approve(BX_PROFILE_ACTION_AUTO);
     }
     // alert
     bx_alert('account', 'added', $iAccountId);
     // login to the created account automatically
     bx_login($iAccountId);
     return $iProfileId;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:24,代码来源:BxBaseAccountForms.php


注:本文中的BxDolProfile::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。