1.20.x user.module user_load_by_name($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()

File

modules/user/user.module, line 325
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);
}