mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Correctly set the post author in wp_xmlrpc_server::mw_editPost()
when the current user is not the author of the post.
Props redsweater, markoheijnen, DrewAPicture Fixes #24916 Built from https://develop.svn.wordpress.org/trunk@31983 git-svn-id: http://core.svn.wordpress.org/trunk@31962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ac2f91922
commit
c996169c04
@ -4756,20 +4756,26 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||||||
$post_author = $postdata['post_author'];
|
$post_author = $postdata['post_author'];
|
||||||
|
|
||||||
// Only set the post_author if one is set.
|
// Only set the post_author if one is set.
|
||||||
if ( isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id']) ) {
|
if ( isset( $content_struct['wp_author_id'] ) ) {
|
||||||
switch ( $post_type ) {
|
// Check permissions if attempting to switch author to or from another user.
|
||||||
case 'post':
|
if ( $user->ID != $content_struct['wp_author_id'] || $user->ID != $post_author ) {
|
||||||
if ( !current_user_can('edit_others_posts') )
|
switch ( $post_type ) {
|
||||||
return new IXR_Error( 401, __( 'You are not allowed to change the post author as this user.' ) );
|
case 'post':
|
||||||
break;
|
if ( ! current_user_can( 'edit_others_posts' ) ) {
|
||||||
case 'page':
|
return new IXR_Error( 401, __( 'You are not allowed to change the post author as this user.' ) );
|
||||||
if ( !current_user_can('edit_others_pages') )
|
}
|
||||||
return new IXR_Error( 401, __( 'You are not allowed to change the page author as this user.' ) );
|
break;
|
||||||
break;
|
case 'page':
|
||||||
default:
|
if ( ! current_user_can( 'edit_others_pages' ) ) {
|
||||||
return new IXR_Error( 401, __( 'Invalid post type' ) );
|
return new IXR_Error( 401, __( 'You are not allowed to change the page author as this user.' ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return new IXR_Error( 401, __( 'Invalid post type' ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$post_author = $content_struct['wp_author_id'];
|
||||||
}
|
}
|
||||||
$post_author = $content_struct['wp_author_id'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($content_struct['mt_allow_comments']) ) {
|
if ( isset($content_struct['mt_allow_comments']) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-beta3-31982';
|
$wp_version = '4.2-beta3-31983';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user