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


PHP CRM_Core_BAO_UFMatch::getContactId方法代码示例

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


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

示例1: contactID

 static function contactID($ufID)
 {
     $contactID = CRM_Core_BAO_UFMatch::getContactId($ufID);
     if ($contactID) {
         return $contactID;
     }
     // else synchronize contact for this user
     $account = user_load($ufID);
     CRM_Core_BAO_UFMatch::synchronizeUFMatch($account, $ufID, $account->mail, 'Drupal');
     $contactID = CRM_Core_BAO_UFMatch::getContactId($ufID);
     if (!$contactID) {
         CRM_Core_Error::fatal();
     }
     return $contactID;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:15,代码来源:Utils.php

示例2: loadUser

 /**
  * @param \string $user
  *
  * @return bool
  */
 public function loadUser($user)
 {
     $userdata = get_user_by('login', $user);
     if (!$userdata->data->ID) {
         return FALSE;
     }
     $uid = $userdata->data->ID;
     wp_set_current_user($uid);
     $contactID = CRM_Core_BAO_UFMatch::getContactId($uid);
     // lets store contact id and user id in session
     $session = CRM_Core_Session::singleton();
     $session->set('ufID', $uid);
     $session->set('userID', $contactID);
     return TRUE;
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:20,代码来源:WordPress.php

示例3: authenticate

 /**
  * @inheritDoc
  */
 public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL)
 {
     require_once 'DB.php';
     $config = CRM_Core_Config::singleton();
     $user = NULL;
     if ($loadCMSBootstrap) {
         $bootStrapParams = array();
         if ($name && $password) {
             $bootStrapParams = array('name' => $name, 'pass' => $password);
         }
         CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, FALSE);
     }
     jimport('joomla.application.component.helper');
     jimport('joomla.database.table');
     jimport('joomla.user.helper');
     $JUserTable = JTable::getInstance('User', 'JTable');
     $db = $JUserTable->getDbo();
     $query = $db->getQuery(TRUE);
     $query->select('id, name, username, email, password');
     $query->from($JUserTable->getTableName());
     $query->where('(LOWER(username) = LOWER(\'' . $name . '\')) AND (block = 0)');
     $db->setQuery($query, 0, 0);
     $users = $db->loadObjectList();
     $row = array();
     if (count($users)) {
         $row = $users[0];
     }
     $joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
     if (!defined('JVERSION')) {
         require $joomlaBase . '/libraries/cms/version/version.php';
         $jversion = new JVersion();
         define('JVERSION', $jversion->getShortVersion());
     }
     if (!empty($row)) {
         $dbPassword = $row->password;
         $dbId = $row->id;
         $dbEmail = $row->email;
         if (version_compare(JVERSION, '2.5.18', 'lt') || version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt')) {
             // now check password
             list($hash, $salt) = explode(':', $dbPassword);
             $cryptpass = md5($password . $salt);
             if ($hash != $cryptpass) {
                 return FALSE;
             }
         } else {
             if (!JUserHelper::verifyPassword($password, $dbPassword, $dbId)) {
                 return FALSE;
             }
             //include additional files required by Joomla 3.2.1+
             if (version_compare(JVERSION, '3.2.1', 'ge')) {
                 require_once $joomlaBase . '/libraries/cms/application/helper.php';
                 require_once $joomlaBase . '/libraries/cms/application/cms.php';
                 require_once $joomlaBase . '/libraries/cms/application/administrator.php';
             }
         }
         CRM_Core_BAO_UFMatch::synchronizeUFMatch($row, $dbId, $dbEmail, 'Joomla');
         $contactID = CRM_Core_BAO_UFMatch::getContactId($dbId);
         if (!$contactID) {
             return FALSE;
         }
         return array($contactID, $dbId, mt_rand());
     }
     return FALSE;
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:67,代码来源:Joomla.php

示例4: checkDownloadInvoice

 /**
  * Verify if the user has permission to get the invoice.
  *
  * @return bool
  *   TRUE if the user has download all invoices permission or download my
  *   invoices permission and the invoice author is the current user.
  */
 public static function checkDownloadInvoice()
 {
     global $user;
     $cid = CRM_Core_BAO_UFMatch::getContactId($user->uid);
     if (CRM_Core_Permission::check('access CiviContribute') || CRM_Core_Permission::check('view my invoices') && $_GET['cid'] == $cid) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:16,代码来源:Permission.php

示例5: crm_uf_get_match_id

/** 
 * get the contact_id given a uf_id 
 * 
 * @param int $ufID
 * 
 * @return int contact_id 
 * @access public    
 * @static 
 */
function crm_uf_get_match_id($ufID)
{
    require_once 'CRM/Core/BAO/UFMatch.php';
    return CRM_Core_BAO_UFMatch::getContactId($ufID);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:14,代码来源:UFGroup.php

示例6: _civicrm_api3_resolve_contactID

/**
 * Determine a contact ID using a string expression.
 *
 * @param string $contactIdExpr
 *   E.g. "user_contact_id" or "@user:username".
 *
 * @return int|NULL|'unknown-user'
 */
function _civicrm_api3_resolve_contactID($contactIdExpr)
{
    // If value = 'user_contact_id' replace value with logged in user id.
    if ($contactIdExpr == "user_contact_id") {
        return CRM_Core_Session::getLoggedInContactID();
    } elseif (preg_match('/^@user:(.*)$/', $contactIdExpr, $matches)) {
        $config = CRM_Core_Config::singleton();
        $ufID = $config->userSystem->getUfId($matches[1]);
        if (!$ufID) {
            return 'unknown-user';
        }
        $contactID = CRM_Core_BAO_UFMatch::getContactId($ufID);
        if (!$contactID) {
            return 'unknown-user';
        }
        return $contactID;
    }
    return NULL;
}
开发者ID:sugan2111,项目名称:Drupal_code,代码行数:27,代码来源:utils.php

示例7:

}
?>
</table>
<?php 
if (isset($this->params)) {
    echo $this->params->render('params');
}
?>

<?php 
require_once 'administrator/components/com_civicrm/civicrm.settings.php';
require_once 'CRM/Core/Config.php';
$civiConfig =& CRM_Core_Config::singleton();
$civiConfig->formKeyDisable = true;
require_once 'CRM/Core/BAO/UFMatch.php';
$userID = CRM_Core_BAO_UFMatch::getContactId($this->user->id);
require_once 'CRM/Core/BAO/UFGroup.php';
echo CRM_Core_BAO_UFGroup::getEditHTML($userID, null, 2, true, true, null, false, 'Individual');
?>

	<button class="button" type="submit" onclick="submitbutton( this.form );return false;"><?php 
echo JText::_('Save');
?>
</button>

	<input type="hidden" name="username" value="<?php 
echo $this->user->get('username');
?>
" />
	<input type="hidden" name="id" value="<?php 
echo $this->user->get('id');
开发者ID:ksecor,项目名称:civicrm,代码行数:31,代码来源:form.php

示例8: register_save

 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function register_save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // do civicrm validation here
     require_once 'administrator/components/com_civicrm/civicrm.settings.php';
     require_once 'CRM/Core/Config.php';
     $civiConfig =& CRM_Core_Config::singleton();
     $civiConfig->formKeyDisable = true;
     require_once 'CRM/Core/BAO/UFGroup.php';
     $errors = CRM_Core_BAO_UFGroup::isValid(null, null, true);
     if (is_array($errors)) {
         $msg = null;
         foreach ($errors as $name => $error) {
             $msg .= "{$name}: {$error}<br/>";
         }
         JError::raiseWarning('', JText::_($msg));
         $this->register();
         return false;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind(JRequest::get('post'), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', '');
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     $date =& JFactory::getDate();
     $user->set('registerDate', $date->toMySQL());
     // If user activation is turned on, we need to set the activation information
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1') {
         jimport('joomla.user.helper');
         $user->set('activation', md5(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         $this->register();
         return false;
     }
     // Send registration confirmation mail
     $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     UserController::_sendMail($user, $password);
     // if this was a successful save, call civicrm code to save the contact
     if ($user->id) {
         require_once 'CRM/Core/BAO/UFMatch.php';
         CRM_Core_BAO_UFMatch::synchronize($user, true, 'Joomla', 'Individual');
         $userID = CRM_Core_BAO_UFMatch::getContactId($user->id);
         if ($userID) {
             require_once 'CRM/Core/BAO/UFGroup.php';
             CRM_Core_BAO_UFGroup::getEditHTML($userID, null, 2, true, false, null, false, 'Individual');
             $session =& CRM_Core_Session::singleton();
             $session->reset();
         }
     }
     // Everything went fine, set relevant message depending upon user activation state and display message
     if ($useractivation == 1) {
         $message = JText::_('REG_COMPLETE_ACTIVATE');
     } else {
         $message = JText::_('REG_COMPLETE');
     }
     //TODO :: this needs to be replace by raiseMessage
     JError::raiseNotice('', $message);
     $this->register();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:92,代码来源:controller.php

示例9: loadUser

 /**
  * @param \string $username
  * @param \string $password
  *
  * @return bool
  */
 public function loadUser($username, $password = NULL)
 {
     $uid = JUserHelper::getUserId($username);
     if (empty($uid)) {
         return FALSE;
     }
     $contactID = CRM_Core_BAO_UFMatch::getContactId($uid);
     if (!empty($password)) {
         $instance = JFactory::getApplication('site');
         $params = array('username' => $username, 'password' => $password);
         //perform the login action
         $instance->login($params);
     }
     $session = CRM_Core_Session::singleton();
     $session->set('ufID', $uid);
     $session->set('userID', $contactID);
     return TRUE;
 }
开发者ID:scardinius,项目名称:civicrm-core,代码行数:24,代码来源:Joomla.php

示例10: loadUser

 /**
  * @inheritDoc
  */
 public function loadUser($username)
 {
     $user = user_load_by_name($username);
     if (!$user) {
         return FALSE;
     }
     // Set Drupal's current user to the loaded user.
     \Drupal::currentUser()->setAccount($user);
     $uid = $user->id();
     $contact_id = CRM_Core_BAO_UFMatch::getContactId($uid);
     // Store the contact id and user id in the session
     $session = CRM_Core_Session::singleton();
     $session->set('ufID', $uid);
     $session->set('userID', $contact_id);
     return TRUE;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:19,代码来源:Drupal8.php

示例11: civicrm_uf_match_id_get

/**
 * get the contact_id given a uf_id
 *
 * @param int $ufID
 *
 * @return int contact_id
 * @access public
 * @static
 */
function civicrm_uf_match_id_get($ufID)
{
    if ((int) $ufID > 0) {
        require_once 'CRM/Core/BAO/UFMatch.php';
        return CRM_Core_BAO_UFMatch::getContactId($ufID);
    } else {
        return civicrm_create_error('Param needs to be a positive integer.');
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:18,代码来源:UFGroup.php

示例12: authenticate

 /**
  * Authenticate the user against the drupal db
  *
  * @param string $name     the user name
  * @param string $password the password for the above user name
  *
  * @return mixed false if no auth
  *               array( contactID, ufID, unique string ) if success
  * @access public
  * @static
  */
 static function authenticate($name, $password)
 {
     require_once 'DB.php';
     $config =& CRM_Core_Config::singleton();
     $dbDrupal = DB::connect($config->userFrameworkDSN);
     if (DB::isError($dbDrupal)) {
         CRM_Core_Error::fatal("Cannot connect to drupal db via {$config->userFrameworkDSN}, " . $dbDrupal->getMessage());
     }
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $password = md5($password);
     $name = $dbDrupal->escapeSimple($strtolower($name));
     $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '{$name}' AND u.pass = '{$password}' AND u.status = 1";
     $query = $dbDrupal->query($sql);
     $user = null;
     // need to change this to make sure we matched only one row
     require_once 'CRM/Core/BAO/UFMatch.php';
     while ($row = $query->fetchRow(DB_FETCHMODE_ASSOC)) {
         CRM_Core_BAO_UFMatch::synchronizeUFMatch($user, $row['uid'], $row['mail'], 'Drupal');
         $contactID = CRM_Core_BAO_UFMatch::getContactId($row['uid']);
         if (!$contactID) {
             return false;
         }
         return array($contactID, $row['uid'], mt_rand());
     }
     return false;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:37,代码来源:Drupal.php

示例13: authenticate

 /**
 * Authenticate the user against the joomla db
 *
 * @param string $name     the user name
 * @param string $password the password for the above user name
 * @param $loadCMSBootstrap boolean load cms bootstrap?
 *
 * @return mixed false if no auth
 *               array(
 contactID, ufID, unique string ) if success
 * @access public
 */
 function authenticate($name, $password, $loadCMSBootstrap = FALSE)
 {
     require_once 'DB.php';
     $config = CRM_Core_Config::singleton();
     if ($loadCMSBootstrap) {
         $bootStrapParams = array();
         if ($name && $password) {
             $bootStrapParams = array('name' => $name, 'pass' => $password);
         }
         CRM_Utils_System::loadBootStrap($bootStrapParams);
     }
     jimport('joomla.application.component.helper');
     jimport('joomla.database.table');
     $JUserTable =& JTable::getInstance('User', 'JTable');
     $db = $JUserTable->getDbo();
     $query = $db->getQuery(TRUE);
     $query->select('id, username, email, password');
     $query->from($JUserTable->getTableName());
     $query->where('(LOWER(username) = LOWER(\'' . $name . '\')) AND (block = 0)');
     $db->setQuery($query, 0, 0);
     $users = $db->loadAssocList();
     $row = array();
     if (count($users)) {
         $row = $users[0];
     }
     $user = NULL;
     if (!empty($row)) {
         $dbPassword = CRM_Utils_Array::value('password', $row);
         $dbId = CRM_Utils_Array::value('id', $row);
         $dbEmail = CRM_Utils_Array::value('email', $row);
         // now check password
         if (strpos($dbPassword, ':') === FALSE) {
             if ($dbPassword != md5($password)) {
                 return FALSE;
             }
         } else {
             list($hash, $salt) = explode(':', $dbPassword);
             $cryptpass = md5($password . $salt);
             if ($hash != $cryptpass) {
                 return FALSE;
             }
         }
         CRM_Core_BAO_UFMatch::synchronizeUFMatch($user, $dbId, $dbEmail, 'Joomla');
         $contactID = CRM_Core_BAO_UFMatch::getContactId($dbId);
         if (!$contactID) {
             return FALSE;
         }
         return array($contactID, $dbId, mt_rand());
     }
     return FALSE;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:63,代码来源:Joomla.php

示例14: authenticate

 /**
 * Authenticate the user against the wordpress db
 *
 * @param string $name     the user name
 * @param string $password the password for the above user name
 *
 * @return mixed false if no auth
 *               array(
    contactID, ufID, unique string ) if success
 * @access public
 * @static
 */
 function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL)
 {
     $config = CRM_Core_Config::singleton();
     if ($loadCMSBootstrap) {
         $config->userSystem->loadBootStrap($name, $password);
     }
     $user = wp_authenticate($name, $password);
     if (is_a($user, 'WP_Error')) {
         return FALSE;
     }
     // need to change this to make sure we matched only one row
     CRM_Core_BAO_UFMatch::synchronizeUFMatch($user->data, $user->data->ID, $user->data->user_email, 'WordPress');
     $contactID = CRM_Core_BAO_UFMatch::getContactId($user->data->ID);
     if (!$contactID) {
         return FALSE;
     }
     return array($contactID, $user->data->ID, mt_rand());
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:30,代码来源:WordPress.php

示例15: authenticate

 /**
  * Authenticate the user against the joomla db
  *
  * @param string $name     the user name
  * @param string $password the password for the above user name
  *
  * @return mixed false if no auth
  *               array( contactID, ufID, unique string ) if success
  * @access public
  * @static
  */
 static function authenticate($name, $password)
 {
     require_once 'DB.php';
     $config =& CRM_Core_Config::singleton();
     $dbJoomla = DB::connect($config->userFrameworkDSN);
     if (DB::isError($dbJoomla)) {
         CRM_Core_Error::fatal("Cannot connect to joomla db via {$config->userFrameworkDSN}, " . $dbJoomla->getMessage());
     }
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $name = $dbJoomla->escapeSimple($strtolower($name));
     $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.username) = '{$name}' AND u.block = 0";
     $query = $dbJoomla->query($sql);
     $user = null;
     require_once 'CRM/Core/BAO/UFMatch.php';
     if ($row = $query->fetchRow(DB_FETCHMODE_ASSOC)) {
         // now check password
         if (strpos($row['password'], ':') === false) {
             if ($row['password'] != md5($password)) {
                 return false;
             }
         } else {
             list($hash, $salt) = explode(':', $row['password']);
             $cryptpass = md5($password . $salt);
             if ($hash != $cryptpass) {
                 return false;
             }
         }
         CRM_Core_BAO_UFMatch::synchronizeUFMatch($user, $row['id'], $row['email'], 'Joomla');
         $contactID = CRM_Core_BAO_UFMatch::getContactId($row['id']);
         if (!$contactID) {
             return false;
         }
         return array($contactID, $row['id'], mt_rand());
     }
     return false;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:47,代码来源:Joomla.php


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