function user_load_by_name

Same name in other branches
  1. 9 core/modules/user/user.module \user_load_by_name()
  2. 8.9.x core/modules/user/user.module \user_load_by_name()
  3. 10 core/modules/user/user.module \user_load_by_name()
  4. 11.x 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

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.