function user_load_multiple
user_load_multiple(array $uids = NULL, $reset = FALSE)
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.
Deprecated
in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\user\Entity\User::loadMultiple().
See also
\Drupal\user\Entity\User::load()
\Drupal\Core\Entity\Query\QueryInterface
File
- core/modules/user/user.module, line 191
- Enables the user registration and login system.
Code
function user_load_multiple(array $uids = NULL, $reset = FALSE) { if ($reset) { \Drupal::entityManager()->getStorage('user')->resetCache($uids); } return User::loadMultiple($uids); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!user!user.module/function/user_load_multiple/8.1.x