user_load

user_load($uid, $reset = FALSE)

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 216
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);
}
doc_Drupal
2016-10-29 09:53:16
Comments
Leave a Comment

Please login to continue.