Ticket #42267: 42267.patch
| File 42267.patch, 4.1 KB (added by , 9 years ago) |
|---|
-
wp-includes/class-wp-xmlrpc-server.php
1415 1415 $post_data['post_author'] = absint( $post_data['post_author'] ); 1416 1416 if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { 1417 1417 if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) 1418 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) );1418 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts.' ) ); 1419 1419 1420 1420 $author = get_userdata( $post_data['post_author'] ); 1421 1421 … … 5007 5007 switch ( $post_type ) { 5008 5008 case "post": 5009 5009 if ( !current_user_can( 'edit_others_posts' ) ) 5010 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) );5010 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts.' ) ); 5011 5011 break; 5012 5012 case "page": 5013 5013 if ( !current_user_can( 'edit_others_pages' ) ) 5014 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create pages as this user.' ) );5014 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create pages.' ) ); 5015 5015 break; 5016 5016 default: 5017 5017 return new IXR_Error( 401, __( 'Invalid post type.' ) ); … … 5347 5347 switch ( $post_type ) { 5348 5348 case 'post': 5349 5349 if ( ! current_user_can( 'edit_others_posts' ) ) { 5350 return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the post author as this user.' ) );5350 return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the post author.' ) ); 5351 5351 } 5352 5352 break; 5353 5353 case 'page': 5354 5354 if ( ! current_user_can( 'edit_others_pages' ) ) { 5355 return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the page author as this user.' ) );5355 return new IXR_Error( 401, __( 'Sorry, you are not allowed to change the page author.' ) ); 5356 5356 } 5357 5357 break; 5358 5358 default: -
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
488 488 $post_type = get_post_type_object( $this->post_type ); 489 489 490 490 if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 491 return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );491 return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to create posts.' ), array( 'status' => rest_authorization_required_code() ) ); 492 492 } 493 493 494 494 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) { … … 496 496 } 497 497 498 498 if ( ! current_user_can( $post_type->cap->create_posts ) ) { 499 return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );499 return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create posts.' ), array( 'status' => rest_authorization_required_code() ) ); 500 500 } 501 501 502 502 if ( ! $this->check_assign_terms_permission( $request ) ) { … … 630 630 } 631 631 632 632 if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 633 return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to update posts as this user.' ), array( 'status' => rest_authorization_required_code() ) );633 return new WP_Error( 'rest_cannot_edit_others', __( 'Sorry, you are not allowed to update posts.' ), array( 'status' => rest_authorization_required_code() ) ); 634 634 } 635 635 636 636 if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)