Changeset 20410
- Timestamp:
- 04/09/2012 10:01:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pluggable.php
r20402 r20410 28 28 global $current_user; 29 29 30 if ( isset( $current_user) && ($id == $current_user->ID) )30 if ( isset( $current_user ) && ( $current_user instanceof WP_User ) && ( $id == $current_user->ID ) ) 31 31 return $current_user; 32 32 33 $current_user = new WP_User( $id, $name);34 35 setup_userdata( $current_user->ID);33 $current_user = new WP_User( $id, $name ); 34 35 setup_userdata( $current_user->ID ); 36 36 37 37 do_action('set_current_user'); … … 76 76 77 77 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) { 78 wp_set_current_user( 0);78 wp_set_current_user( 0 ); 79 79 return false; 80 80 } 81 81 82 if ( ! empty($current_user) ) 83 return; 82 if ( ! empty( $current_user ) ) { 83 if ( $current_user instanceof WP_User ) 84 return; 85 86 // Upgrade stdClass to WP_User 87 if ( is_object( $current_user ) && isset( $current_user->ID ) ) { 88 $cur_id = $current_user->ID; 89 $current_user = null; 90 wp_set_current_user( $cur_id ); 91 return; 92 } 93 94 // $current_user has a junk value. Force to WP_User with ID 0. 95 $current_user = null; 96 wp_set_current_user( 0 ); 97 return false; 98 } 84 99 85 100 if ( ! $user = wp_validate_auth_cookie() ) { 86 if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {87 wp_set_current_user( 0);101 if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) || !$user = wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' ) ) { 102 wp_set_current_user( 0 ); 88 103 return false; 89 104 } 90 105 } 91 106 92 wp_set_current_user( $user);107 wp_set_current_user( $user ); 93 108 } 94 109 endif;
Note: See TracChangeset
for help on using the changeset viewer.