Don't override the $current_user global in get_currentuserinfo() on an XML-RPC request

if it's non-empty. Fixes capabilities checks for XML-RPC requests. See #20372.


git-svn-id: http://svn.automattic.com/wordpress/trunk@20424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
duck_ 2012-04-10 16:19:53 +00:00
parent baf681233f
commit b0a975512a
1 changed files with 5 additions and 5 deletions

View File

@ -74,11 +74,6 @@ if ( !function_exists('get_currentuserinfo') ) :
function get_currentuserinfo() {
global $current_user;
if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
wp_set_current_user( 0 );
return false;
}
if ( ! empty( $current_user ) ) {
if ( $current_user instanceof WP_User )
return;
@ -97,6 +92,11 @@ function get_currentuserinfo() {
return false;
}
if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
wp_set_current_user( 0 );
return false;
}
if ( ! $user = wp_validate_auth_cookie() ) {
if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) || !$user = wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' ) ) {
wp_set_current_user( 0 );