WordPress.org

Make WordPress Core

Ticket #38857: 38857.2.patch

File 38857.2.patch, 6.4 KB (added by SergeyBiryukov, 5 years ago)
  • src/wp-admin/edit-tags.php

     
    1818        wp_die( __( 'Invalid taxonomy.' ) );
    1919
    2020if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) {
    21    wp_die( __( 'Sorry, you are not allowed to manage these items.' ) );
     21   wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
    2222}
    2323
    2424if ( ! current_user_can( $tax->cap->manage_terms ) ) {
    2525        wp_die(
    2626                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
    27                 '<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>',
     27                '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
    2828                403
    2929        );
    3030}
     
    7474        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
    7575                wp_die(
    7676                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
    77                         '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>',
     77                        '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
    7878                        403
    7979                );
    8080        }
  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

     
    117117                }
    118118
    119119                if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
    120                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view comments with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     120                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
    121121                }
    122122
    123123                if ( ! current_user_can( 'edit_posts' ) ) {
     
    320320                }
    321321
    322322                if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
    323                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view comments with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     323                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit comments.' ), array( 'status' => rest_authorization_required_code() ) );
    324324                }
    325325
    326326                return true;
  • src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php

     
    127127                }
    128128
    129129                if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) {
    130                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     130                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit posts in this post type.' ), array( 'status' => rest_authorization_required_code() ) );
    131131                }
    132132
    133133                $data = $this->prepare_item_for_response( $obj, $request );
  • src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php

     
    141141                                return false;
    142142                        }
    143143                        if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->manage_terms ) ) {
    144                                 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
     144                                return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
    145145                        }
    146146                }
    147147
  • src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

     
    141141                        return false;
    142142                }
    143143                if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
    144                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     144                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
    145145                }
    146146                return true;
    147147        }
     
    302302                        return false;
    303303                }
    304304                if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
    305                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     305                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
    306306                }
    307307                return true;
    308308        }
  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

     
    148148                }
    149149
    150150                if ( 'edit' === $request['context'] && ! current_user_can( 'list_users' ) ) {
    151                         return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     151                        return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to browse users.' ), array( 'status' => rest_authorization_required_code() ) );
    152152                }
    153153
    154154                if ( in_array( $request['orderby'], array( 'email', 'registered_date' ), true ) && ! current_user_can( 'list_users' ) ) {