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()

17 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.
EntityTranslationController::entityFormEntityBuild in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
Entity builder method.

... See full list

File

drupal/core/modules/user/user.module, line 341
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 $users ? reset($users)
    ->getBCEntity() : FALSE;
}