CoreFiles by mySites.guru
helper.php60 lines, 1,453 bytes, from Joomla_3.3.4-Stable-Full_Package.zip
Raw History Compare with 3.3.3
md5
a441e84b82dab064f2939f824cf61fed
sha1
f1968675687a13ca7714520852015016f8fade02
sha256
07a8282049e8ae0a72dacafdbba6adafdf6f84707a22f4cd6bbc54598a71c64a
<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_users_latest
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Helper for mod_users_latest
 *
 * @package     Joomla.Site
 * @subpackage  mod_users_latest
 *
 * @since       1.6
 */
class ModUsersLatestHelper
{
	/**
	 * Get users sorted by activation date
	 * 
	 * @param   \Joomla\Registry\Registry  $params  module parameters
	 * 
	 * @return  array  The array of users
	 * 
	 * @since   1.6
	 */
	public static function getUsers($params)
	{
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true)
			->select($db->quoteName(array('a.id', 'a.name', 'a.username', 'a.registerDate')))
			->order($db->quoteName('a.registerDate') . ' DESC')
			->from('#__users AS a');
		$user = JFactory::getUser();

		if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1)
		{
			$groups = $user->getAuthorisedGroups();

			if (empty($groups))
			{
				return array();
			}

			$query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = a.id')
				->join('LEFT', '#__usergroups AS ug ON ug.id = m.group_id')
				->where('ug.id in (' . implode(',', $groups) . ')')
				->where('ug.id <> 1');
		}

		$db->setQuery($query, 0, $params->get('shownumber'));
		$result = $db->loadObjectList();

		return (array) $result;
	}
}

The same content is in 4 releases, Joomla 3.3.4 to 3.4.0-alpha. See them all, or every version of this file.