/**
* Convenience function for listing users. At time of this writing, it is
* being used by wordpress widgets to display recently active users.
*
* @since 2.0.?
* @access public
* @param string $SortField The field to sort users with. Defaults to DateLastActive. Other options are: DateInserted, Name.
* @param string $SortDirection The direction to sort the users.
* @param int $Limit The number of users to show.
* @param int $Offset The offset to start listing users at.
*/
public function summary($SortField = 'DateLastActive', $SortDirection = 'desc', $Limit = 30, $Offset = 0)
{
// Added permission check Oct 2014 - Guest now requires Profiles.View for WP widget to work.
$this->permission('Garden.Profiles.View');
$this->title(t('User Summary'));
// Input validation
$SortField = !in_array($SortField, array('DateLastActive', 'DateInserted', 'Name')) ? 'DateLastActive' : $SortField;
$SortDirection = $SortDirection == 'asc' ? 'asc' : 'desc';
$Limit = is_numeric($Limit) && $Limit < 100 && $Limit > 0 ? $Limit : 30;
$Offset = is_numeric($Offset) ? $Offset : 0;
// Get user list
$UserModel = new UserModel();
$UserData = $UserModel->getSummary('u.' . $SortField, $SortDirection, $Limit, $Offset);
$this->setData('UserData', $UserData);
$this->MasterView = 'empty';
$this->render('filenotfound', 'home');
}