From 6bef163456d888b8a104878510ab15f249a1b57f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 2 Sep 2013 03:24:33 +0000 Subject: [PATCH] Update phpdoc for get_user_to_edit(), get_userdata(), and get_user_by(). props tivnet. fixes #24992. git-svn-id: https://develop.svn.wordpress.org/trunk@25204 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/user.php | 5 +++-- src/wp-includes/pluggable.php | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php index 9e9d94494c..a2b02b208d 100644 --- a/src/wp-admin/includes/user.php +++ b/src/wp-admin/includes/user.php @@ -195,12 +195,13 @@ function get_editable_roles() { * @since 2.0.5 * * @param int $user_id User ID. - * @return object WP_User object with user data. + * @return WP_User|bool WP_User object on success, false on failure. */ function get_user_to_edit( $user_id ) { $user = get_userdata( $user_id ); - $user->filter = 'edit'; + if ( $user ) + $user->filter = 'edit'; return $user; } diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index b097bca227..4d5368e345 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -115,7 +115,7 @@ if ( !function_exists('get_userdata') ) : * @since 0.71 * * @param int $user_id User ID - * @return bool|object False on failure, WP_User object on success + * @return WP_User|bool WP_User object on success, false on failure. */ function get_userdata( $user_id ) { return get_user_by( 'id', $user_id ); @@ -130,7 +130,7 @@ if ( !function_exists('get_user_by') ) : * * @param string $field The field to retrieve the user with. id | slug | email | login * @param int|string $value A value for $field. A user ID, slug, email address, or login name. - * @return bool|object False on failure, WP_User object on success + * @return WP_User|bool WP_User object on success, false on failure. */ function get_user_by( $field, $value ) { $userdata = WP_User::get_data_by( $field, $value ); @@ -463,7 +463,7 @@ if ( !function_exists('wp_authenticate') ) : * * @param string $username User's username * @param string $password User's password - * @return WP_Error|WP_User WP_User object if login successful, otherwise WP_Error object. + * @return WP_User|WP_Error WP_User object if login successful, otherwise WP_Error object. */ function wp_authenticate($username, $password) { $username = sanitize_user($username);