WordPress.org

Make WordPress Core

Changeset 39251


Ignore:
Timestamp:
11/15/16 20:36:27 (12 months ago)
Author:
SergeyBiryukov
Message:

REST API: Unify permission error messages.

Props ramiy.
See #38791, #34521.

Location:
trunk/src/wp-includes/rest-api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39250 r39251  
    451451 
    452452        if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 
    453             return new WP_Error( 'rest_cannot_edit_others', __( 'You are not allowed to create posts as this user.' ), array( 'status' => rest_authorization_required_code() ) ); 
     453            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() ) ); 
    454454        } 
    455455 
    456456        if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 
    457             return new WP_Error( 'rest_cannot_assign_sticky', __( 'You do not have permission to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) ); 
     457            return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) ); 
    458458        } 
    459459 
     
    463463 
    464464        if ( ! $this->check_assign_terms_permission( $request ) ) { 
    465             return new WP_Error( 'rest_cannot_assign_term', __( 'You do not have permission to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) ); 
     465            return new WP_Error( 'rest_cannot_assign_term', __( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) ); 
    466466        } 
    467467 
     
    592592 
    593593        if ( ! empty( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 
    594             return new WP_Error( 'rest_cannot_edit_others', __( 'You are not allowed to update posts as this user.' ), array( 'status' => rest_authorization_required_code() ) ); 
     594            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() ) ); 
    595595        } 
    596596 
    597597        if ( ! empty( $request['sticky'] ) && ! current_user_can( $post_type->cap->edit_others_posts ) ) { 
    598             return new WP_Error( 'rest_cannot_assign_sticky', __( 'You do not have permission to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) ); 
     598            return new WP_Error( 'rest_cannot_assign_sticky', __( 'Sorry, you are not allowed to make posts sticky.' ), array( 'status' => rest_authorization_required_code() ) ); 
    599599        } 
    600600 
    601601        if ( ! $this->check_assign_terms_permission( $request ) ) { 
    602             return new WP_Error( 'rest_cannot_assign_term', __( 'You do not have permission to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) ); 
     602            return new WP_Error( 'rest_cannot_assign_term', __( 'Sorry, you are not allowed to assign the provided terms.' ), array( 'status' => rest_authorization_required_code() ) ); 
    603603        } 
    604604 
  • trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

    r39245 r39251  
    178178                'rest_cannot_delete', 
    179179                /* translators: %s: custom field key */ 
    180                 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ), 
     180                sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ), 
    181181                array( 'key' => $name, 'status' => rest_authorization_required_code() ) 
    182182            ); 
     
    213213                'rest_cannot_update', 
    214214                /* translators: %s: custom field key */ 
    215                 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ), 
     215                sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ), 
    216216                array( 'key' => $name, 'status' => rest_authorization_required_code() ) 
    217217            ); 
     
    284284                'rest_cannot_update', 
    285285                /* translators: %s: custom field key */ 
    286                 sprintf( __( 'You do not have permission to edit the %s custom field.' ), $name ), 
     286                sprintf( __( 'Sorry, you are not allowed to edit the %s custom field.' ), $name ), 
    287287                array( 'key' => $name, 'status' => rest_authorization_required_code() ) 
    288288            ); 
Note: See TracChangeset for help on using the changeset viewer.