Changeset 36651 for trunk/src/wp-includes/pluggable.php
- Timestamp:
- 02/23/2016 10:25:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r36617 r36651 66 66 */ 67 67 function wp_get_current_user() { 68 global $current_user; 69 70 if ( ! empty( $current_user ) ) { 71 if ( $current_user instanceof WP_User ) { 72 return $current_user; 73 } 74 75 // Upgrade stdClass to WP_User 76 if ( is_object( $current_user ) && isset( $current_user->ID ) ) { 77 $cur_id = $current_user->ID; 78 $current_user = null; 79 wp_set_current_user( $cur_id ); 80 return $current_user; 81 } 82 83 // $current_user has a junk value. Force to WP_User with ID 0. 84 $current_user = null; 85 wp_set_current_user( 0 ); 86 return $current_user; 87 } 88 89 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) { 90 wp_set_current_user( 0 ); 91 return $current_user; 92 } 93 94 /** 95 * Filter the current user. 96 * 97 * The default filters use this to determine the current user from the 98 * request's cookies, if available. 99 * 100 * Returning a value of false will effectively short-circuit setting 101 * the current user. 102 * 103 * @since 3.9.0 104 * 105 * @param int|bool $user_id User ID if one has been determined, false otherwise. 106 */ 107 $user_id = apply_filters( 'determine_current_user', false ); 108 if ( ! $user_id ) { 109 wp_set_current_user( 0 ); 110 return $current_user; 111 } 112 113 wp_set_current_user( $user_id ); 114 115 return $current_user; 68 return _wp_get_current_user(); 116 69 } 117 70 endif;
Note: See TracChangeset
for help on using the changeset viewer.