function user_load

7.x user.module user_load($uid, $reset = FALSE)
6.x user.module user_load($user_info = array())

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

$uid: Integer specifying the user ID to load.

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

Return value

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

See also

user_load_multiple()

50 calls to user_load()
comment_tokens in drupal-7.x/modules/comment/comment.tokens.inc
Implements hook_tokens().
DrupalWebTestCase::setUp in drupal-7.x/modules/simpletest/drupal_web_test_case.php
Sets up a Drupal site for running functional and integration tests.
EntityCrudHookTestCase::testUserHooks in drupal-7.x/modules/simpletest/tests/entity_crud_hook_test.test
Tests hook invocations for CRUD operations on users.
FileValidatorTest::testFileValidateSize in drupal-7.x/modules/simpletest/tests/file.test
Test file_validate_size().
FormatDateUnitTest::testFormatDate in drupal-7.x/modules/simpletest/tests/common.test
Tests for the format_date() function.

... See full list

File

drupal-7.x/modules/user/user.module, line 365
Enables the user registration and login system.

Code

function user_load($uid, $reset = FALSE) {
  $users = user_load_multiple(array($uid), array(), $reset);
  return reset($users);
}