欢迎各位兄弟 发布技术文章
这里的技术是共享的
Fetch a user object by account name.
$name: String with the account's user name.
A fully-loaded $user object upon successful user load or FALSE if user cannot be loaded.
modules/
user/
user.module, line 397
Enables the user registration and login system.
function user_load_by_name($name) { $users = user_load_multiple(array( ), array( 'name' => $name, )); return reset($users); }
来自 https://api.drupal.org/api/drupal/modules!user!user.module/function/user_load_by_name/7.x
Comments
Beware of static cache!
This function is a simple wrapper to DrupalEntityControllerInterface::load(), which statically caches results.
Calling this function more than once during a single pageload could return stale results.
Log in or register to post comments
Is this API works for only
Is this API works for only logged in user. If yes I need to load before login if exists. Any help