Changeset 36311 for trunk/src/wp-includes/pluggable.php
- Timestamp:
- 01/15/2016 10:15:21 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r36246 r36311 55 55 * Retrieve the current user object. 56 56 * 57 * @since 2.0.358 *59 * @global WP_User $current_user60 *61 * @return WP_User Current user WP_User object62 */63 function wp_get_current_user() {64 global $current_user;65 66 get_currentuserinfo();67 68 return $current_user;69 }70 endif;71 72 if ( !function_exists('get_currentuserinfo') ) :73 /**74 * Populate global variables with information about the currently logged in user.75 *76 57 * Will set the current user, if the current user is not set. The current user 77 58 * will be set to the logged-in person. If no user is logged-in, then it will 78 59 * set the current user to 0, which is invalid and won't have any permissions. 79 60 * 80 * @since 0.7181 * 82 * @global WP_User $current_user Checks if the current user is set 83 * 84 * @return false|void False on XML-RPC Request and invalid auth cookie.85 */ 86 function get_currentuserinfo() {61 * @since 2.0.3 62 * 63 * @global WP_User $current_user Checks if the current user is set. 64 * 65 * @return bool|WP_User WP_User instance on success, false on XMLRPC Request and invalid auth cookie. 66 */ 67 function wp_get_current_user() { 87 68 global $current_user; 88 69 89 70 if ( ! empty( $current_user ) ) { 90 if ( $current_user instanceof WP_User ) 91 return; 71 if ( $current_user instanceof WP_User ) { 72 return $current_user; 73 } 92 74 93 75 // Upgrade stdClass to WP_User … … 96 78 $current_user = null; 97 79 wp_set_current_user( $cur_id ); 98 return ;80 return $current_user; 99 81 } 100 82 … … 130 112 131 113 wp_set_current_user( $user_id ); 114 115 return $current_user; 132 116 } 133 117 endif;
Note: See TracChangeset
for help on using the changeset viewer.