function user_load_multiple

Loads 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.

Parameters

array $uids: (optional) An array of entity IDs. If omitted, all entities are loaded.

bool $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

array An array of user objects, indexed by uid.

See also

entity_load_multiple()

user_load()

user_load_by_mail()

user_load_by_name()

\Drupal\Core\Entity\Query\QueryInterface

6 calls to user_load_multiple()
CommentRenderController::buildContent in drupal/core/modules/comment/lib/Drupal/comment/CommentRenderController.php
Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
Uid::titleQuery in drupal/core/modules/user/lib/Drupal/user/Plugin/views/argument/Uid.php
Override the behavior of title(). Get the name of the user.
User::processSummaryArguments in drupal/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
Process the summary arguments for displaying.
UserOnlineBlock::build in drupal/core/modules/user/lib/Drupal/user/Plugin/Block/UserOnlineBlock.php
Builds and returns the renderable array for this block plugin.
user_attach_accounts in drupal/core/modules/user/user.module
Populates $entity->account for each prepared entity.

... See full list

File

drupal/core/modules/user/user.module, line 276
Enables the user registration and login system.

Code

function user_load_multiple(array $uids = NULL, $reset = FALSE) {
  $entities = entity_load_multiple('user', $uids, $reset);

  // Return BC-entities.
  foreach ($entities as $id => $entity) {
    $entities[$id] = $entity
      ->getBCEntity();
  }
  return $entities;
}