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


PHP CUserHelper::getUserId方法代码示例

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


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

示例1: onUserLogin

 /**
  * This method should handle any login logic and report back to the subject
  * For Joomla 1.6, onLoginUser is now onUserLogin
  *
  * @access	public
  * @param 	array 	holds the user data
  * @param 	array    extra options
  * @return	boolean	True on success
  * @since	1.6
  */
 public function onUserLogin($user, $options)
 {
     $app = JFactory::getApplication();
     $cUser = CFactory::getUser(CUserHelper::getUserId($user['username']));
     if ($cUser->block) {
         $app->setUserState('users.login.form.return', 'index.php?option=com_users&view=profile');
     }
     return $this->onLoginUser($user, $options);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:19,代码来源:jomsocialuser.php

示例2: _buildQuery

 public function _buildQuery()
 {
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $actor = $jinput->get('actor', '', 'NONE');
     //JRequest::getVar( 'actor' , '' );
     $archived = JRequest::getInt('archived', 0);
     $app = $jinput->get('app', 'none', 'NONE');
     //JRequest::getVar( 'app' , 'none' );
     $where = array();
     $userId = 0;
     if (!empty($actor)) {
         $userId = CUserHelper::getUserId($actor);
     }
     if ($userId != 0) {
         $where[] = 'actor=' . $db->Quote($userId) . ' ';
     }
     if ($archived != 0) {
         $archived = $archived - 1;
         $where[] = 'archived=' . $db->Quote($archived) . ' ';
     }
     if ($app != 'none') {
         $where[] = 'app=' . $db->Quote($app);
     }
     $query = 'SELECT * FROM ' . $db->quoteName('#__community_activities');
     if (!empty($where)) {
         for ($i = 0; $i < count($where); $i++) {
             if ($i == 0) {
                 $query .= ' WHERE ';
             } else {
                 $query .= ' AND ';
             }
             $query .= $where[$i];
         }
     }
     $query .= ' ORDER BY created DESC';
     return $query;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:39,代码来源:activities.php

示例3: cGetUserId

/**
 * Deprecated since 1.8
 * Use CUserHelper::getUserId instead. 
 */
function cGetUserId($username)
{
    return CUserHelper::getUserId($username);
}
开发者ID:bizanto,项目名称:Hooked,代码行数:8,代码来源:user.php

示例4: replaceAliasURL

 /**
  * Automatically link username in the provided message when message contains @username
  * 
  * @param	$message	A string of message that may or may not contain @username
  *
  * return	$message	A modified copy of the message with the proper hyperlinks.
  **/
 public static function replaceAliasURL($message)
 {
     $pattern = '/@(("(.*)")|([A-Z0-9][A-Z0-9_-]+)([A-Z0-9][A-Z0-9_-]+))/i';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[0]) && !empty($matches[0])) {
         CFactory::load('helpers', 'user');
         CFactory::load('helpers', 'linkgenerator');
         $usernames = $matches[0];
         for ($i = 0; $i < count($usernames); $i++) {
             $username = $usernames[$i];
             $username = CString::str_ireplace('"', '', $username);
             $username = explode('@', $username);
             $username = $username[1];
             $id = CUserHelper::getUserId($username);
             if ($id != 0) {
                 $message = CString::str_ireplace($username, CLinkGeneratorHelper::getUserURL($id, $username), $message);
             }
         }
     }
     return $message;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:28,代码来源:linkgenerator.php


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