User Search extends the Database Item List. Click here to read more about the database item list class.

Instantiating the UserList object

	Loader::model('user_list');
	$ul = new UserList();

Methods Available

$ul->filterByUserName($username)

Filters a list by username.

$ul->filterByKeywords($keywords)

Filters a list by keywords, which searches

  1. Username
  2. Email
  3. Any user attributes marked as being included in the search index.

$ul->filterByGroup($groupName)

Filters by Group name.

$ul->filterByGroupID($groupID)

Only shows users in a particular group (by ID.)

$ul->filterByDateAdded($date, $comparison = '=')

Filters by date. Allows all MySQL comparison symbols (greather than, less than, etc...)

$ul->filterByIsActive($active)

Filters by $active users (1 or 0.)

$ul->filterByAttribute($attributeKeyHandle, $value, $comparison = '=')

Filters by a user attribute key handle. Additionally, the UserList class has a magic method which will allow all user attribute key sorting based on handle

	$ul->filterByDateOfBirth('1979-07-11', '=');
	$ul->filterByGender('male');

$users = $ul->get($itemsToGet = 100, $offset = 0)

Gets all users who fit the criteria.

$users->getPage($page = false)

Gets a page of users (taking into account $itemsPerPage, current page, etc...)

Recent Discussions on this Topic

filterByAttribute

I want to search the users with the magic method of the user_list model. This is my code [code] $userList->filterByAddress('%'.$keywords.'%', 'LIKE'); $userList->filterByZipcode('%'.$keywords.'%', 'LIKE'); $userList->filterByCity('%'.$keywords.'%…

excluding users from the members list

I tried setting up a checkbox as a user attribute and then filtering on that, like: [code]$userList->filterByExcludeFromDirectory(1, '!=');[/code] Oddly, that would only filter out the super user, and no others... So I came up with this kind of jan…