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


PHP CUser::init方法代码示例

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


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

示例1: loadUsers

 /**
  * Load multiple users at a same time to save up on the queries.
  * @return	boolean		True upon success
  * @param	Array	$userIds	An array of user ids to be loaded.
  */
 public static function loadUsers($userIds)
 {
     $userIds = array_diff_key($userIds, self::$instances);
     if (empty($userIds)) {
         return;
     }
     $ids = implode(",", $userIds);
     $db = JFactory::getDBO();
     $query = 'SELECT  ' . ' a.' . $db->quoteName('userid') . ' as _userid ,' . ' a.' . $db->quoteName('status') . ' as _status , ' . ' a.' . $db->quoteName('points') . ' as _points, ' . ' a.' . $db->quoteName('posted_on') . ' as _posted_on, ' . ' a.' . $db->quoteName('avatar') . ' as _avatar , ' . ' a.' . $db->quoteName('thumb') . ' as _thumb , ' . ' a.' . $db->quoteName('invite') . ' as _invite, ' . ' a.' . $db->quoteName('params') . ' as _cparams,  ' . ' a.' . $db->quoteName('view') . ' as _view, ' . ' a.' . $db->quoteName('friends') . ' as _friends, ' . ' a.' . $db->quoteName('groups') . ' as _groups, ' . ' a.' . $db->quoteName('events') . ' as _events, ' . ' a.' . $db->quoteName('alias') . '	as _alias, ' . ' a.' . $db->quoteName('profile_id') . ' as _profile_id, ' . ' a.' . $db->quoteName('friendcount') . ' as _friendcount, ' . ' a.' . $db->quoteName('storage') . ' as _storage, ' . ' a.' . $db->quoteName('watermark_hash') . ' as _watermark_hash, ' . ' a.' . $db->quoteName('search_email') . ' AS _search_email, ' . ' s.' . $db->quoteName('userid') . ' as _isonline, u.* ' . ' FROM ' . $db->quoteName('#__community_users') . ' as a ' . ' LEFT JOIN ' . $db->quoteName('#__users') . ' u ' . ' ON u.' . $db->quoteName('id') . '=a.' . $db->quoteName('userid') . ' LEFT OUTER JOIN ' . $db->quoteName('#__session') . 's ' . ' ON s.' . $db->quoteName('userid') . '=a.' . $db->quoteName('userid') . ' WHERE a.' . $db->quoteName('userid') . ' IN (' . $ids . ')';
     $db->setQuery($query);
     $objs = $db->loadObjectList();
     foreach ($objs as $obj) {
         $user = new CUser($obj->_userid);
         $isNewUser = $user->init($obj);
         $user->getThumbAvatar();
         // technically, we should not fetch any new user here
         if ($isNewUser) {
             // New user added to jomSocial database
             // trigger event onProfileInit
             $appsLib = CAppPlugins::getInstance();
             $appsLib->loadApplications();
             $args = array();
             $args[] = $user;
             $appsLib->triggerEvent('onProfileCreate', $args);
         }
         CFactory::getUser($obj->_userid, $user);
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:33,代码来源:core.php

示例2: loadUsers

 /**
  * Load multiple users at a same time to save up on the queries.
  * @return	boolean		True upon success
  * @param	Array	$userIds	An array of user ids to be loaded.
  */
 public function loadUsers($userIds)
 {
     if (empty($userIds)) {
         return;
     }
     $ids = implode(",", $userIds);
     $db =& JFactory::getDBO();
     $query = "SELECT  " . "\ta.`userid` as _userid , " . "\ta.`status` as _status , " . "\ta.`points`\tas _points, " . "\ta.`posted_on` as _posted_on, " . "\ta.`avatar`\tas _avatar , " . "\ta.`thumb`\tas _thumb , " . "\ta.`invite`\tas _invite, " . "\ta.`params`\tas _cparams,  " . "\ta.`view`\tas _view, " . " a.`friendcount` as _friendcount, " . " a.`alias`\tas _alias, " . " a.`profile_id` as _profile_id, " . " a.`friendcount` as _friendcount, " . " a.`storage` as _storage, " . " a.`watermark_hash` as _watermark_hash, " . "s.`userid` as _isonline, u.* " . " FROM #__community_users as a " . " LEFT JOIN #__users u " . " ON u.`id`=a.`userid` " . " LEFT OUTER JOIN #__session s " . " ON s.`userid`=a.`userid` " . "WHERE a.`userid` IN ({$ids})";
     $db->setQuery($query);
     $objs = $db->loadObjectList();
     foreach ($objs as $obj) {
         $user = new CUser($obj->_userid);
         $isNewUser = $user->init($obj);
         $user->getThumbAvatar();
         // technically, we should not fetch any new user here
         if ($isNewUser) {
             // New user added to jomSocial database
             // trigger event onProfileInit
             $appsLib = CAppPlugins::getInstance();
             $appsLib->loadApplications();
             $args = array();
             $args[] = $user;
             $appsLib->triggerEvent('onProfileCreate', $args);
         }
         CFactory::getUser($obj->_userid, $user);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:core.php

示例3: getFriendRecords

 /**
  * Return an array of friend records
  * This is a temporary solution to for the performance issue on photo page view.
  * Todo: need to support pagination on the cWindow
  */
 public function getFriendRecords($id)
 {
     if ($id == 0) {
         // guest obviously has no frinds
         $fid = array();
         return $fid;
     }
     $db = JFactory::getDBO();
     $query = 'SELECT DISTINCT(a.' . $db->quoteName('connect_to') . ') AS id , b.' . $db->quoteName('name') . ' , b.' . $db->quoteName('username') . ' , u.' . $db->quoteName('params') . 'AS _cparams' . ' , b.' . $db->quoteName('params') . 'AS params' . ' FROM ' . $db->quoteName('#__community_connection') . ' AS a' . ' INNER JOIN ' . $db->quoteName('#__users') . ' AS b  ' . ' ON a.' . $db->quoteName('connect_from') . '=' . $db->Quote($id) . ' AND b.' . $db->quoteName('block') . '=' . $db->Quote(0) . ' AND a.' . $db->quoteName('connect_to') . '=b.' . $db->quoteName('id') . ' AND a.' . $db->quoteName('status') . '=' . $db->Quote(1) . ' LEFT JOIN ' . $db->quoteName('#__community_users') . ' u ' . ' ON a.' . $db->quoteName('connect_to') . '=u.' . $db->quoteName('userid') . ' WHERE NOT EXISTS ( SELECT d.' . $db->quoteName('blocked_userid') . ' FROM ' . $db->quoteName('#__community_blocklist') . ' AS d  WHERE d.' . $db->quoteName('userid') . ' = ' . $db->Quote($id) . ' AND d.' . $db->quoteName('blocked_userid') . ' = a.' . $db->quoteName('connect_to') . ')' . ' ORDER BY a.' . $db->quoteName('connection_id') . ' DESC';
     $db->setQuery($query);
     $friends = $db->loadObjectList();
     $users = array();
     foreach ($friends as $friend) {
         $user = new CUser($friend->id);
         $isNewUser = $user->init($friend);
         $users[] = $user;
     }
     return $users;
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:24,代码来源:friends.php


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