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


PHP BxDolProfile::getInstanceByAccount方法代码示例

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


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

示例1: __construct

 public function __construct($iAccoutId = 0)
 {
     parent::__construct();
     $sKey = getParam('bx_antispam_akismet_api_key');
     if ($sKey && ($oAccount = BxDolAccount::getInstance((int) $iAccoutId))) {
         require_once BX_DIRECTORY_PATH_PLUGINS . 'akismet/Akismet.class.php';
         $this->oAkismet = new Akismet(BX_DOL_URL_ROOT, $sKey);
         $oProfile = BxDolProfile::getInstanceByAccount((int) $iAccoutId);
         $this->oAkismet->setCommentAuthorEmail($oAccount->getEmail());
         $this->oAkismet->setCommentAuthor($oProfile->getDisplayName());
         $this->oAkismet->setCommentAuthorURL($oProfile->getUrl());
     }
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:13,代码来源:BxAntispamAkismet.php

示例2: _createProfileRaw

 /**
  * Create new profile;
  *
  * @param  : $aProfileInfo (array) - remote profile's information;
  *
  * @param  : $sAlternativeName (string) - profiles alternative nickname;
  * @return : error string or error or request invite form or profile info array on success
  */
 function _createProfileRaw($aProfileInfo, $sAlternativeName = '', $isAutoFriends = true, $isSetLoggedIn = true)
 {
     // join by invite only
     if (BxDolRequest::serviceExists('bx_invites', 'account_add_form_check') && ($sCode = BxDolService::call('bx_invites', 'account_add_form_check'))) {
         return $sCode;
     }
     // convert fields to unique format
     $aFieldsProfile = $aFieldsAccount = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
     if (empty($aFieldsProfile['email'])) {
         return _t('_Incorrect Email');
     }
     // prepare fields for particular module
     $aFieldsAccount = BxDolService::call('system', 'prepare_fields', array($aFieldsAccount));
     $aFieldsProfile = BxDolService::call($this->_oConfig->sProfilesModule, 'prepare_fields', array($aFieldsProfile));
     // check fields existence in Account
     $oFormHelperAccount = BxDolService::call('system', 'forms_helper');
     $oFormAccount = $oFormHelperAccount->getObjectFormAdd();
     foreach ($aFieldsAccount as $sKey => $mValue) {
         if (!$oFormAccount->isFieldExist($sKey)) {
             unset($aFieldsAccount[$sKey]);
         }
     }
     // check fields existence in Profile
     if ('system' != $this->_oConfig->sProfilesModule && ($oFormHelperProfile = BxDolService::call($this->_oConfig->sProfilesModule, 'forms_helper'))) {
         $oFormProfile = $oFormHelperProfile->getObjectFormAdd();
         foreach ($aFieldsProfile as $sKey => $mValue) {
             if (!$oFormProfile->isFieldExist($sKey)) {
                 unset($aFieldsProfile[$sKey]);
             }
         }
     }
     // antispam check
     $sErrorMsg = '';
     $bSetPendingApproval = false;
     bx_alert('account', 'check_join', 0, false, array('error_msg' => &$sErrorMsg, 'email' => $aFieldsAccount['email'], 'approve' => &$bSetPendingApproval));
     if ($sErrorMsg) {
         return $sErrorMsg;
     }
     // check if user with the same email already exists
     $oExistingAccount = BxDolAccount::getInstance($aFieldsAccount['email']);
     // check redirect page
     if ('join' == $this->_oConfig->sRedirectPage && !$oExistingAccount) {
         return array('remote_profile_info' => $aProfileInfo, 'profile_fields' => $aFieldsAccount, 'join_page_redirect' => true);
     }
     // create new profile
     if ($oExistingAccount) {
         if (!($oExistingProfile = BxDolProfile::getInstanceByAccount($oExistingAccount->id()))) {
             return _t('_sys_txt_error_account_creation');
         }
         $iProfileId = $oExistingProfile->id();
         $this->setLogged($iProfileId);
     } else {
         // create account
         $aFieldsAccount['password'] = genRndPwd();
         $aFieldsAccount['email_confirmed'] = $this->_oConfig->isAlwaysConfirmEmail;
         if (!($iAccountId = $oFormAccount->insert($aFieldsAccount))) {
             return _t('_sys_txt_error_account_creation');
         }
         $isSetPendingApproval = $this->_oConfig->isAlwaysAutoApprove ? false : !(bool) getParam('sys_account_autoapproval');
         $iAccountProfileId = $oFormHelperAccount->onAccountCreated($iAccountId, $isSetPendingApproval, BX_PROFILE_ACTION_EXTERNAL);
         // create profile
         if (isset($oFormProfile) && $oFormProfile) {
             $aFieldsProfile['picture'] = $this->_processImage($aFieldsProfile, $iAccountProfileId, $oFormHelperProfile);
             if (!($iContentId = $oFormProfile->insert($aFieldsProfile))) {
                 return _t('_sys_txt_error_account_creation');
             }
             $oFormHelperProfile->setAutoApproval($oFormHelperProfile->isAutoApproval() ? true : $this->_oConfig->isAlwaysAutoApprove);
             if ($sErrorMsg = $oFormHelperProfile->onDataAddAfter($iAccountId, $iContentId)) {
                 return $sErrorMsg;
             }
             $oProfile = BxDolProfile::getInstanceByAccount($iAccountId);
             $iProfileId = $oProfile->id();
         } else {
             $iProfileId = $iAccountProfileId;
         }
         // send email with password
         sendMailTemplate($this->_oConfig->sEmailTemplatePasswordGenerated, $iAccountId, $iProfileId, array('password' => $aFieldsAccount['password']), BX_EMAIL_SYSTEM);
     }
     // remember remote profile id for created member
     $this->_oDb->saveRemoteId($iProfileId, $aProfileInfo['id']);
     // auto-friend members if they are already friends on remote site
     if ($isAutoFriends && method_exists($this, '_makeFriends')) {
         $this->_makeFriends($iProfileId);
     }
     return array('remote_profile_info' => $aProfileInfo, 'profile_id' => $iProfileId, 'existing_profile' => $oExistingAccount ? true : false);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:94,代码来源:BxBaseModConnectModule.php


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