You are here

function user_load in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/user.module \user_load()

Loads a user object.

Parameters

int $uid: Integer specifying the user ID to load.

bool $reset: TRUE to reset the internal cache and load from the database; FALSE (default) to load from the internal cache, if set.

Return value

\Drupal\user\UserInterface A fully-loaded user object upon successful user load, or NULL if the user cannot be loaded.

Deprecated

in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\user\Entity\User::load().

See also

\Drupal\user\Entity\User::loadMultiple()

File

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

Code

function user_load($uid, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()
      ->getStorage('user')
      ->resetCache(array(
      $uid,
    ));
  }
  return User::load($uid);
}