Make WordPress Core

Ticket #42267: 42267.patch

File 42267.patch, 4.1 KB (added by ramiy, 9 years ago)
  • wp-includes/class-wp-xmlrpc-server.php

     
    14151415                $post_data['post_author'] = absint( $post_data['post_author'] );
    14161416                if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) {
    14171417                        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.' ) );
    14191419
    14201420                        $author = get_userdata( $post_data['post_author'] );
    14211421
    … …  
    50075007                        switch ( $post_type ) {
    50085008                                case "post":
    50095009                                        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.' ) );
    50115011                                        break;
    50125012                                case "page":
    50135013                                        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.' ) );
    50155015                                        break;
    50165016                                default:
    50175017                                        return new IXR_Error( 401, __( 'Invalid post type.' ) );
    … …  
    53475347                                switch ( $post_type ) {
    53485348                                        case 'post':
    53495349                                                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.' ) );
    53515351                                                }
    53525352                                                break;
    53535353                                        case 'page':
    53545354                                                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.' ) );
    53565356                                                }
    53575357                                                break;
    53585358                                        default:
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

     
    488488                $post_type = get_post_type_object( $this->post_type );
    489489
    490490                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() ) );
    492492                }
    493493
    494494                if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {
    … …  
    496496                }
    497497
    498498                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() ) );
    500500                }
    501501
    502502                if ( ! $this->check_assign_terms_permission( $request ) ) {
    … …  
    630630                }
    631631
    632632                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() ) );
    634634                }
    635635
    636636                if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) {