本文整理匯總了PHP中CRM_Core_BAO_CMSUser::updateUFName方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_BAO_CMSUser::updateUFName方法的具體用法?PHP CRM_Core_BAO_CMSUser::updateUFName怎麽用?PHP CRM_Core_BAO_CMSUser::updateUFName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Core_BAO_CMSUser
的用法示例。
在下文中一共展示了CRM_Core_BAO_CMSUser::updateUFName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateUFName
/**
* update the uf_name in the user object
*
* @param int $contactId id of the contact to update
*
* @return void
* @access public
* @static
*/
static function updateUFName($contactId)
{
$config =& CRM_Core_Config::singleton();
if ($config->userFramework == 'Standalone') {
$ufName = CRM_Contact_BAO_Contact::getPrimaryOpenId($contactId);
} else {
$ufName = CRM_Contact_BAO_Contact::getPrimaryEmail($contactId);
}
if (!$ufName) {
return;
}
$ufmatch =& new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
$ufmatch->domain_id = CRM_Core_Config::domainID();
if (!$ufmatch->find(true) || $ufmatch->uf_name == $ufName) {
// if object does not exist or the OpenID has not changed
return;
}
// save the updated ufmatch object
$ufmatch->uf_name = $ufName;
$ufmatch->save();
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::updateUFName($ufmatch->uf_id, $ufName);
}
示例2: updateUFName
/**
* update the uf_name in the user object
*
* @param int $contactId id of the contact to update
*
* @return void
* @access public
* @static
*/
static function updateUFName($contactId)
{
if (!$contactId) {
return;
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework == 'Standalone') {
$ufName = CRM_Contact_BAO_Contact::getPrimaryOpenId($contactId);
} else {
$ufName = CRM_Contact_BAO_Contact::getPrimaryEmail($contactId);
}
if (!$ufName) {
return;
}
$update = false;
// 1.do check for contact Id.
$ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
$ufmatch->domain_id = CRM_Core_Config::domainID();
if (!$ufmatch->find(true)) {
return;
}
if ($ufmatch->uf_name != $ufName) {
$update = true;
}
// CRM-6928
// 2.do check for duplicate ufName.
$ufDupeName = new CRM_Core_DAO_UFMatch();
$ufDupeName->uf_name = $ufName;
$ufDupeName->domain_id = CRM_Core_Config::domainID();
if ($ufDupeName->find(true) && $ufDupeName->contact_id != $contactId) {
$update = false;
}
if (!$update) {
return;
}
// save the updated ufmatch object
$ufmatch->uf_name = $ufName;
$ufmatch->save();
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::updateUFName($ufmatch->uf_id, $ufName);
}