function user_load

Loads a user object.

Drupal has a global $user object, which represents the currently-logged-in user. So to avoid confusion and to avoid clobbering the global $user object, it is a good idea to assign the result of this function to a different local variable, generally $account. If you actually do want to act as the user you are loading, it is essential to call drupal_save_session(FALSE); first. See Safely impersonating another user for more information.

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

object A fully-loaded user object upon successful user load, or FALSE if the user cannot be loaded.

See also

user_load_multiple()

49 calls to user_load()
comment_tokens in drupal/core/modules/comment/comment.tokens.inc
Implements hook_tokens().
DrupalDateTimeTest::testDateTimezone in drupal/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
Test that DrupalDateTime can detect the right timezone to use. Test with a variety of less commonly used timezone names to help ensure that the system timezone will be different than the stated timezones.
EntityCrudHookTest::testUserHooks in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
Tests hook invocations for CRUD operations on users.
FormatDateTest::testFormatDate in drupal/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
Tests the format_date() function.
hook_file_copy in drupal/core/modules/file/file.api.php
Respond to a file that has been copied.

... See full list

File

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

Code

function user_load($uid, $reset = FALSE) {
  return entity_load('user', $uid, $reset);
}