wp-includes/ms-functions.php:
wpmu_new_site_admin_notification()
|
Notifies the Multisite network administrator that a new site was created.
|
wp-includes/user.php:
wp_authenticate_application_password()
|
Authenticates the user using an application password.
|
wp-admin/includes/schema.php:
populate_network_meta()
|
Creates WordPress network meta and sets the default values.
|
wp-includes/meta.php:
get_object_subtype()
|
Returns the object subtype for a given object ID of a specific type.
|
wp-includes/user.php:
wp_create_user_request()
|
Create and log a user request to perform a specific action.
|
wp-includes/user.php:
wp_user_personal_data_exporter()
|
Finds and exports personal data associated with an email address from the user and user_meta table.
|
wp-includes/media.php:
wp_media_personal_data_exporter()
|
Finds and exports attachments associated with an email address.
|
wp-admin/includes/privacy-tools.php:
_wp_personal_data_handle_actions()
|
Handle list table actions.
|
wp-includes/l10n.php:
get_user_locale()
|
Retrieves the locale of a user.
|
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:
WP_REST_Users_Controller::create_item()
|
Creates a single user.
|
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:
WP_REST_Users_Controller::update_item()
|
Updates a single user.
|
wp-includes/user.php:
wp_authenticate_email_password()
|
Authenticates a user using the email and password.
|
wp-includes/link-template.php:
get_avatar_data()
|
Retrieves default data about the avatar.
|
wp-login.php:
retrieve_password()
|
Handles sending a password retrieval email to a user.
|
wp-includes/pluggable.php:
wp_validate_auth_cookie()
|
Validates authentication cookie.
|
wp-includes/pluggable.php:
get_userdata()
|
Retrieve user info by user ID.
|
wp-includes/deprecated.php:
get_profile()
|
Retrieve user data based on field.
|
wp-includes/class-wp-query.php:
WP_Query::get_posts()
|
Retrieves an array of posts based on query variables.
|
wp-includes/user.php:
check_password_reset_key()
|
Retrieves a user row based on password reset key and login
|
wp-includes/user.php:
username_exists()
|
Determines whether the given username exists.
|
wp-includes/user.php:
email_exists()
|
Determines whether the given email exists.
|
wp-includes/user.php:
wp_authenticate_username_password()
|
Authenticate a user, confirming the username and password are valid.
|
wp-includes/pluggable-deprecated.php:
get_userdatabylogin()
|
Retrieve user info by login name.
|
wp-includes/pluggable-deprecated.php:
get_user_by_email()
|
Retrieve user info by email.
|
wp-includes/pluggable-deprecated.php:
wp_setcookie()
|
Sets a cookie for a user who just logged in. This function is deprecated.
|
wp-includes/post.php:
get_pages()
|
Retrieve an array of pages (or hierarchical post type items).
|
wp-includes/ms-functions.php:
is_user_spammy()
|
Check to see whether a user is marked as a spammer, based on user login.
|
wp-includes/ms-functions.php:
wpmu_signup_blog_notification()
|
Send a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked.
|
wp-includes/ms-functions.php:
wpmu_signup_user_notification()
|
Send a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked.
|
wp-includes/ms-deprecated.php:
is_site_admin()
|
Determine if user is a site admin.
|
wp-includes/ms-deprecated.php:
get_user_details()
|
Deprecated functionality to retrieve user information.
|
wp-includes/ms-deprecated.php:
get_user_id_from_string()
|
Get a numeric user ID from either an email address or a login.
|
wp-includes/comment.php:
check_comment()
|
Check whether a comment passes internal checks to be allowed to add.
|
Default usage
Sample response of
object(WP_User)#96 (7) {
["data"]=>
object(stdClass)#95 (10) {
["ID"]=>
string(1) "1"
["user_login"]=>
string(10) "superadmin"
["user_pass"]=>
string(34) "$P$Bx0Jgq6/Qw/o3A5fXcVKg4jxQr2PAB1"
["user_nicename"]=>
string(10) "superadmin"
["user_email"]=>
string(16) "user@example.com"
["user_url"]=>
string(0) ""
["user_registered"]=>
string(19) "2014-02-21 21:31:40"
["user_activation_key"]=>
string(0) ""
["user_status"]=>
string(1) "0"
["display_name"]=>
string(10) "superadmin"
}
["ID"]=>
int(1)
["caps"]=>
array(1) {
["administrator"]=>
bool(true)
}
["cap_key"]=>
string(25) "wp_capabilities"
["roles"]=>
array(1) {
[0]=>
string(13) "administrator"
}
["allcaps"]=>
array(63) {
["switch_themes"]=>
bool(true)
["edit_themes"]=>
bool(true)
["activate_plugins"]=>
bool(true)
["edit_plugins"]=>
bool(true)
["edit_users"]=>
bool(true)
["edit_files"]=>
bool(true)
["manage_options"]=>
bool(true)
["moderate_comments"]=>
bool(true)
["manage_categories"]=>
bool(true)
["manage_links"]=>
bool(true)
["upload_files"]=>
bool(true)
["import"]=>
bool(true)
["unfiltered_html"]=>
bool(true)
["edit_posts"]=>
bool(true)
["edit_others_posts"]=>
bool(true)
["edit_published_posts"]=>
bool(true)
["publish_posts"]=>
bool(true)
["edit_pages"]=>
bool(true)
["read"]=>
bool(true)
["level_10"]=>
bool(true)
["level_9"]=>
bool(true)
["level_8"]=>
bool(true)
["level_7"]=>
bool(true)
["level_6"]=>
bool(true)
["level_5"]=>
bool(true)
["level_4"]=>
bool(true)
["level_3"]=>
bool(true)
["level_2"]=>
bool(true)
["level_1"]=>
bool(true)
["level_0"]=>
bool(true)
["edit_others_pages"]=>
bool(true)
["edit_published_pages"]=>
bool(true)
["publish_pages"]=>
bool(true)
["delete_pages"]=>
bool(true)
["delete_others_pages"]=>
bool(true)
["delete_published_pages"]=>
bool(true)
["delete_posts"]=>
bool(true)
["delete_others_posts"]=>
bool(true)
["delete_published_posts"]=>
bool(true)
["delete_private_posts"]=>
bool(true)
["edit_private_posts"]=>
bool(true)
["read_private_posts"]=>
bool(true)
["delete_private_pages"]=>
bool(true)
["edit_private_pages"]=>
bool(true)
["read_private_pages"]=>
bool(true)
["delete_users"]=>
bool(true)
["create_users"]=>
bool(true)
["unfiltered_upload"]=>
bool(true)
["edit_dashboard"]=>
bool(true)
["update_plugins"]=>
bool(true)
["delete_plugins"]=>
bool(true)
["install_plugins"]=>
bool(true)
["update_themes"]=>
bool(true)
["install_themes"]=>
bool(true)
["update_core"]=>
bool(true)
["list_users"]=>
bool(true)
["remove_users"]=>
bool(true)
["add_users"]=>
bool(true)
["promote_users"]=>
bool(true)
["edit_theme_options"]=>
bool(true)
["delete_themes"]=>
bool(true)
["export"]=>
bool(true)
["administrator"]=>
bool(true)
}
["filter"]=>
NULL
}
I always prefer to check if the variable ($user) is empty or not before echoing any properties of the $user object:
$user = get_user_by( ’email’, ‘user@example.com’ );
if ( ! empty( $user ) ) {
echo ‘User is ‘ . $user->first_name . ‘ ‘ . $user->last_name;
}
This is to keep things clean and prevent error messages and warnings.
To obtain user’s email via this, you have to use “user_email” property, not just “email”.
$user = get_user_by('login', $username);
if ($user) {
$details['name'] = $user->first_name . ' ' . $user->last_name;
$details['email'] = $user->user_email;
};
If you want to get the user id from user loginname.
is case sensitive. Which means
would not match any users with like