function user_load_by_name

Fetches a user object by account name.

Parameters

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

Return value

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

See also

user_load_multiple()

18 calls to user_load_by_name()
CommentFormController::submit in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::submit().
CommentFormController::validate in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::validate().
comment_preview in drupal/core/modules/comment/comment.module
Generates a comment preview.
DBLogTest::doUser in drupal/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php
Generates and then verifies some user events.
NodeFormController::validate in drupal/core/modules/node/lib/Drupal/node/NodeFormController.php
Overrides Drupal\Core\Entity\EntityFormController::validate().

... See full list

File

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

Code

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