7 user.module user_load_multiple($uids = array(), $conditions = array(), $reset = FALSE)
8 user.module user_load_multiple(array $uids = NULL, $reset = FALSE)

Load multiple users based on certain conditions.

This function should be used whenever you need to load more than one user from the database. Users are loaded into memory and will not require database access if loaded again during the same page request.

@todo Remove $conditions in Drupal 8.


$uids: An array of user IDs.

$conditions: (deprecated) An associative array of conditions on the {users} table, where the keys are the database fields and the values are the values those fields must have. Instead, it is preferable to use EntityFieldQuery to retrieve a list of entity IDs loadable by this function.

$reset: A boolean indicating that the internal cache should be reset. Use this if loading a user object which has been altered during the page request.

Return value

An array of user objects, indexed by uid.

See also






17 calls to user_load_multiple()


modules/user/user.module, line 290
Enables the user registration and login system.


function user_load_multiple($uids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('user', $uids, $conditions, $reset);


is there an argument to load multiple users with a particular proximity (proximity pre-defined in a view)?


You would more likely want to simply supply this function with a list of uids derived from a specific query; user_load_multiple() is not for looking for uids but for returning actual Drupal user entity objects. Sure, a Views query could work for generating that list of uids.

See http://drupal.stackexchange.com/questions/11175/get-all-users-with-speci... for this 'missing' bit of Drupal's API.

Here's the code we're using:

function examplemodule_users_by_role($role_name) {
$role = user_role_load_by_name($role_name);
$query = 'SELECT ur.uid
    FROM {users_roles} AS ur
    WHERE ur.rid = :rid'
$result = db_query($query, array(':rid' => $role->rid));
$uids = $result->fetchCol();

You can use this function to load users by role

"A fully-loaded role object", not user objects.