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


PHP CRM_Core_BAO_UFMatch::synchronize方法代码示例

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


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

示例1: civicrm_invoke

function civicrm_invoke()
{
    civicrm_init();
    plugin_init();
    $user = JFactory::getUser();
    /* bypass synchronize if running upgrade
     * to avoid any serious non-recoverable error
     * which might hinder the upgrade process.
     */
    require_once 'CRM/Utils/Array.php';
    if (CRM_Utils_Array::value('task', $_REQUEST) != 'civicrm/upgrade') {
        require_once 'CRM/Core/BAO/UFMatch.php';
        CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
    }
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(NULL, TRUE);
    if (isset($_GET['task'])) {
        $args = explode('/', trim($_GET['task']));
    } else {
        $_GET['task'] = 'civicrm/dashboard';
        $_GET['reset'] = 1;
        $args = array('civicrm', 'dashboard');
    }
    CRM_Core_Invoke::invoke($args);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:25,代码来源:admin.civicrm.php

示例2: civicrm_invoke

function civicrm_invoke()
{
    civicrm_init();
    global $my;
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($my, false, 'Mambo');
    $args = explode('/', trim($_GET['task']));
    CRM_Core_Invoke::invoke($args);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:9,代码来源:admin.civicrm.php

示例3: civicrm_invoke

function civicrm_invoke()
{
    civicrm_init();
    plugin_init();
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, false, 'Joomla', 'Individual');
    if (isset($_GET['task'])) {
        $args = explode('/', trim($_GET['task']));
        CRM_Core_Invoke::invoke($args);
    } else {
        $_GET['task'] = 'civicrm/dashboard';
        $_GET['reset'] = 1;
        $args = array('civicrm', 'dashboard');
        CRM_Core_Invoke::invoke($args);
    }
}
开发者ID:ksecor,项目名称:civicrm,代码行数:17,代码来源:admin.civicrm.php

示例4: civicrm_invoke

function civicrm_invoke()
{
    civicrm_init();
    // check and ensure that we have a valid session
    if (!empty($_POST)) {
        // the session should not be empty
        // however for standalone forms, it will not have any CiviCRM variables in the
        // session either, so dont check for it
        if (count($_SESSION) <= 1) {
            require_once 'CRM/Utils/System.php';
            $config =& CRM_Core_Config::singleton();
            CRM_Utils_System::redirect($config->userFrameworkBaseURL);
        }
    }
    // add all the values from the itemId param
    // overrride the GET values if conflict
    if (CRM_Utils_Array::value('Itemid', $_GET)) {
        $component =& JComponentHelper::getComponent('com_civicrm');
        $menu =& JSite::getMenu();
        $item = $menu->getItems('componentid', $component->id, true);
        $params = $menu->getParams($_GET['Itemid']);
        $args = array('task', 'id', 'gid', 'reset', 'pageId', 'action');
        foreach ($args as $a) {
            $val = $params->get($a, null);
            if ($val !== null) {
                $_GET[$a] = $val;
            }
        }
    }
    $task = CRM_Utils_Array::value('task', $_GET, '');
    $args = explode('/', trim($task));
    // check permission
    if (!civicrm_check_permission($args)) {
        echo "You do not have permission to execute this url.";
        return;
    }
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(null, true);
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, false, 'Joomla', 'Individual');
    CRM_Core_Invoke::invoke($args);
}
开发者ID:bhirsch,项目名称:civicrm,代码行数:43,代码来源:civicrm.php

示例5: civicrm_invoke

function civicrm_invoke()
{
    civicrm_init();
    // check and ensure that we have a valid session
    if (!empty($_POST)) {
        // the session should not be empty
        // however for standalone forms, it will not have any CiviCRM variables in the
        // session either, so dont check for it
        if (count($_SESSION) <= 1) {
            require_once 'CRM/Utils/System.php';
            $config = CRM_Core_Config::singleton();
            CRM_Utils_System::redirect($config->userFrameworkBaseURL);
        }
    }
    // add all the values from the itemId param
    // overrride the GET values if conflict
    if (CRM_Utils_Array::value('Itemid', $_GET)) {
        $component = JComponentHelper::getComponent('com_civicrm');
        $menu = JSite::getMenu();
        $params = $menu->getParams($_GET['Itemid']);
        $args = array('task', 'id', 'gid', 'pageId', 'action', 'csid');
        $view = CRM_Utils_Array::value('view', $_GET);
        if ($view) {
            $args[] = 'reset';
        }
        foreach ($args as $a) {
            $val = $params->get($a, NULL);
            if ($val !== NULL && $view) {
                $_GET[$a] = $val;
            }
        }
    }
    $task = CRM_Utils_Array::value('task', $_GET, '');
    $args = explode('/', trim($task));
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(NULL, TRUE);
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
    CRM_Core_Invoke::invoke($args);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:41,代码来源:civicrm.php

示例6: getUserID

 static function getUserID($user)
 {
     //FIXME: look here a bit closer when testing UFMatch
     require_once 'CRM/Core/BAO/UFMatch.php';
     // this puts the appropriate values in the session, so
     // no need to return anything
     CRM_Core_BAO_UFMatch::synchronize($user, true, 'Standalone', 'Individual');
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:8,代码来源:UnitTests.php

示例7: getUserID

 /**
  * @param $user
  */
 public function getUserID($user)
 {
     //FIXME: look here a bit closer when testing UFMatch
     // this puts the appropriate values in the session, so
     // no need to return anything
     CRM_Core_BAO_UFMatch::synchronize($user, TRUE, 'Standalone', 'Individual');
 }
开发者ID:kidaa30,项目名称:yes,代码行数:10,代码来源:UnitTests.php

示例8: update_user

 /**
  * @description: keep WordPress user synced with CiviCRM Contact
  * Callback function for 'user_register' hook
  * Callback function for 'profile_update' hook
  *
  * CMW: seems to (wrongly) create new CiviCRM Contact every time a user changes their
  * first_name or last_name attributes in WordPress.
  */
 public function update_user($userID)
 {
     $user = get_userdata($userID);
     if ($user) {
         if (!$this->initialize()) {
             return;
         }
         require_once 'CRM/Core/BAO/UFMatch.php';
         // this does not return anything, so if we want to do anything further
         // to the CiviCRM Contact, we have to search for it all over again...
         CRM_Core_BAO_UFMatch::synchronize($user, TRUE, 'WordPress', 'Individual');
         /*
         // IN progress: synchronizeUFMatch does return the contact object, however
         $civi_contact = CRM_Core_BAO_UFMatch::synchronizeUFMatch(
           $user, // user object
           $user->ID, // ID
           $user->user_mail, // unique identifier
           null // unused
           'WordPress' // CMS
           'Individual' // contact type
         );
         
         // now we can allow other plugins to do their thing
         do_action( 'civicrm_contact_synced', $user, $civi_contact );
         */
     }
 }
开发者ID:samuelsov,项目名称:civicrm-wordpress,代码行数:35,代码来源:civicrm.php

示例9: 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

示例10: initialize

 /**
  * Initialize CiviCRM
  *
  * @return bool $success
  */
 public function initialize()
 {
     static $initialized = FALSE;
     static $failure = FALSE;
     if ($failure) {
         return FALSE;
     }
     if (!$initialized) {
         // Check for php version and ensure its greater than minPhpVersion
         $minPhpVersion = '5.3.4';
         if (version_compare(PHP_VERSION, $minPhpVersion) < 0) {
             echo '<p>' . sprintf(__('CiviCRM requires PHP Version %s or greater. You are running PHP Version %s', 'civicrm'), $minPhpVersion, PHP_VERSION) . '<p>';
             exit;
         }
         // check for settings
         if (!CIVICRM_INSTALLED) {
             $error = FALSE;
         } elseif (file_exists(CIVICRM_SETTINGS_PATH)) {
             $error = (include_once CIVICRM_SETTINGS_PATH);
         }
         // autoload
         require_once 'CRM/Core/ClassLoader.php';
         CRM_Core_ClassLoader::singleton()->register();
         // get ready for problems
         $installLink = admin_url() . "options-general.php?page=civicrm-install";
         $docLinkInstall = "http://wiki.civicrm.org/confluence/display/CRMDOC/WordPress+Installation+Guide";
         $docLinkTrouble = "http://wiki.civicrm.org/confluence/display/CRMDOC/Installation+and+Configuration+Trouble-shooting";
         $forumLink = "http://forum.civicrm.org/index.php/board,6.0.html";
         // construct message
         $errorMsgAdd = sprintf(__('Please review the <a href="%s">WordPress Installation Guide</a> and the <a href="%s">Trouble-shooting page</a> for assistance. If you still need help installing, you can often find solutions to your issue by searching for the error message in the <a href="%s">installation support section of the community forum</a>.', 'civicrm'), $docLinkInstall, $docLinkTrouble, $forumLink);
         // does install message get used?
         $installMessage = sprintf(__('Click <a href="%s">here</a> for fresh install.', 'civicrm'), $installLink);
         if ($error == FALSE) {
             header('Location: ' . admin_url() . 'options-general.php?page=civicrm-install');
             return FALSE;
         }
         // access global defined in civicrm.settings.php
         global $civicrm_root;
         // this does pretty much all of the civicrm initialization
         if (!file_exists($civicrm_root . 'CRM/Core/Config.php')) {
             $error = FALSE;
         } else {
             $error = (include_once 'CRM/Core/Config.php');
         }
         // have we got it?
         if ($error == FALSE) {
             // set static flag
             $failure = TRUE;
             // FIX ME - why?
             wp_die("<strong><p class='error'>" . sprintf(__('Oops! - The path for including CiviCRM code files is not set properly. Most likely there is an error in the <em>civicrm_root</em> setting in your CiviCRM settings file (%s).', 'civicrm'), CIVICRM_SETTINGS_PATH) . "</p><p class='error'> &raquo; " . sprintf(__('civicrm_root is currently set to: <em>%s</em>.', 'civicrm'), $civicrm_root) . "</p><p class='error'>" . $errorMsgAdd . "</p></strong>");
             // won't reach here!
             return FALSE;
         }
         // set static flag
         $initialized = TRUE;
         // initialize the system by creating a config object
         $config = CRM_Core_Config::singleton();
         //print_r( $config ); die();
         // sync the logged in user with WP
         global $current_user;
         if ($current_user) {
             // sync procedure sets session values for logged in users
             require_once 'CRM/Core/BAO/UFMatch.php';
             CRM_Core_BAO_UFMatch::synchronize($current_user, FALSE, 'WordPress', $this->users->get_civicrm_contact_type('Individual'));
         }
     }
     // notify plugins
     do_action('civicrm_initialized');
     // success!
     return TRUE;
 }
开发者ID:netconstructor,项目名称:civicrm-wordpress,代码行数:76,代码来源:civicrm.php


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