function user_load
Same name in other branches
- 7.x 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.0.0 and is removed from drupal:9.0.0. Use Drupal\user\Entity\User::load().
See also
https://www.drupal.org/node/2266845
1 call to user_load()
- UserLegacyTest::testEntityLegacyCode in core/
modules/ user/ tests/ src/ Kernel/ UserLegacyTest.php - @expectedDeprecation user_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\user\Entity\User::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation user_load() is deprecated in…
File
-
core/
modules/ user/ user.module, line 249
Code
function user_load($uid, $reset = FALSE) {
@trigger_error('user_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\user\\Entity\\User::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
if ($reset) {
\Drupal::entityTypeManager()->getStorage('user')
->resetCache([
$uid,
]);
}
return User::load($uid);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.