You are here

function user_load_by_name in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \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

\Drupal\user\Entity\User::loadMultiple()

8 calls to user_load_by_name()
ContactPersonalTest::checkContactAccess in core/modules/contact/src/Tests/ContactPersonalTest.php
Creates a user and then checks contact form access.
DbLogTest::doUser in core/modules/dblog/src/Tests/DbLogTest.php
Generates and then verifies some user events.
PathProcessor::processInbound in core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php
Processes the inbound path.
PathProcessorTest::processInbound in core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php
Processes the inbound path.
UserCreateTest::testUserAdd in core/modules/user/src/Tests/UserCreateTest.php
Create a user through the administration interface and ensure that it displays in the user list.

... See full list

File

core/modules/user/user.module, line 249
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) : FALSE;
}