本文整理汇总了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);
}
示例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;
}
示例3: cGetUserId
/**
* Deprecated since 1.8
* Use CUserHelper::getUserId instead.
*/
function cGetUserId($username)
{
return CUserHelper::getUserId($username);
}
示例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;
}