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


PHP KunenaUser::setProperties方法代码示例

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


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

示例1: loadUsers

 /**
  * @param array $userids
  *
  * @return array
  */
 public static function loadUsers(array $userids = array())
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as $userid) {
         // Ignore guests and imported users, which haven't been mapped to Joomla (id<0).
         if ($userid > 0 && empty(self::$_instances[$userid])) {
             $e_userids[(int) $userid] = (int) $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*, u.id AS userid\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(isset($user['posts']));
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $list;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:42,代码来源:helper.php

示例2: loadUsers

 public static function loadUsers(array $userids = array())
 {
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as &$userid) {
         if (!$userid || $userid != intval($userid)) {
             unset($userid);
         } elseif (empty(self::$_instances[$userid])) {
             $e_userids[$userid] = $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(true);
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     return $list;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:36,代码来源:helper.php

示例3: loadUsers

	static public function loadUsers($userids = array()) {
		if (!is_array($userids)) {
			JError::raiseError ( 500, __CLASS__ . '::' . __FUNCTION__.'(): Parameter $userids is not array' );
		}

		// Make sure that userids are unique and that indexes are correct
		$e_userids = array();
		foreach($userids as $userid){
			if (empty ( self::$_instances [intval($userid)] )) $e_userids[intval($userid)] = intval($userid);
		}
		unset($e_userids[0]);
		if (empty($e_userids)) return array();

		$userlist = implode ( ',', $e_userids );

		$db = JFactory::getDBO ();
		$query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*
			FROM #__users AS u
			LEFT JOIN #__kunena_users AS ku ON u.id = ku.userid
			WHERE u.id IN ({$userlist})";
		$db->setQuery ( $query );
		$results = $db->loadAssocList ();
		KunenaError::checkDatabaseError ();

		$list = array ();
		foreach ( $results as $user ) {
			$instance = new KunenaUser (false);
			$instance->setProperties ( $user );
			$instance->exists(true);
			self::$_instances [$instance->userid] = $instance;
		}

		// Finally call integration preload as well
		// Preload avatars if configured
		$avatars = KunenaFactory::getAvatarIntegration();
		$avatars->load($userids);

		foreach ($userids as $userid) {
			if (isset(self::$_instances [$userid])) $list [$userid] = self::$_instances [$userid];
		}
		return $list;
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:42,代码来源:helper.php


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