You are here

function user_load_by_name in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_load_by_name()
  2. 9 core/modules/user/user.module \user_load_by_name()

Fetch a user object by account name.

Parameters

$name: String with the account's user name.

Return value

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

See also

user_load_multiple()

17 calls to user_load_by_name()
comment_form_validate in modules/comment/comment.module
Validate comment form submissions.
comment_preview in modules/comment/comment.module
Generate a comment preview.
comment_submit in modules/comment/comment.module
Prepare a comment for submission.
DBLogTestCase::doUser in modules/dblog/dblog.test
Generates and then verifies some user events.
LocaleUserCreationTest::testLocalUserCreation in modules/locale/locale.test
Functional test for language handling during user creation.

... See full list

File

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

Code

function user_load_by_name($name) {
  $users = user_load_multiple(array(), array(
    'name' => $name,
  ));
  return reset($users);
}