Make WordPress Core


Ignore:
Timestamp:
06/29/2016 03:15:40 PM (8 years ago)
Author:
ocean90
Message:

Text Changes: Unify permission error messages.

The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r37801 r37914  
    3131    if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
    3232        if ( 'page' == $post_data['post_type'] )
    33             return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
     33            return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
    3434        else
    35             return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) );
     35            return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
    3636    } elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
    3737        if ( 'page' == $post_data['post_type'] )
    38             return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
     38            return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
    3939        else
    40             return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) );
     40            return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
    4141    }
    4242
     
    6969        if ( $update ) {
    7070            if ( 'page' == $post_data['post_type'] )
    71                 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
     71                return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
    7272            else
    73                 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) );
     73                return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
    7474        } else {
    7575            if ( 'page' == $post_data['post_type'] )
    76                 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
     76                return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
    7777            else
    78                 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) );
     78                return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
    7979        }
    8080    }
     
    211211    if ( !current_user_can( 'edit_post', $post_ID ) ) {
    212212        if ( 'page' == $post_data['post_type'] )
    213             wp_die( __('You are not allowed to edit this page.' ));
     213            wp_die( __('Sorry, you are not allowed to edit this page.' ));
    214214        else
    215             wp_die( __('You are not allowed to edit this post.' ));
     215            wp_die( __('Sorry, you are not allowed to edit this post.' ));
    216216    }
    217217
     
    429429    if ( !current_user_can( $ptype->cap->edit_posts ) ) {
    430430        if ( 'page' == $ptype->name )
    431             wp_die( __('You are not allowed to edit pages.'));
     431            wp_die( __('Sorry, you are not allowed to edit pages.'));
    432432        else
    433             wp_die( __('You are not allowed to edit posts.'));
     433            wp_die( __('Sorry, you are not allowed to edit posts.'));
    434434    }
    435435
     
    722722    if ( !current_user_can( $ptype->cap->edit_posts ) ) {
    723723        if ( 'page' == $ptype->name )
    724             return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this site.' ) );
     724            return new WP_Error( 'edit_pages', __( 'Sorry, you are not allowed to create pages on this site.' ) );
    725725        else
    726             return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this site.' ) );
     726            return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to create posts or drafts on this site.' ) );
    727727    }
    728728
     
    17251725
    17261726    if ( ! $post = get_post( $post_ID ) ) {
    1727         wp_die( __( 'You are not allowed to edit this post.' ) );
     1727        wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
    17281728    }
    17291729
    17301730    if ( ! current_user_can( 'edit_post', $post->ID ) ) {
    1731         wp_die( __( 'You are not allowed to edit this post.' ) );
     1731        wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
    17321732    }
    17331733
     
    17871787
    17881788    if ( ! current_user_can( 'edit_post', $post->ID ) ) {
    1789         return new WP_Error( 'edit_posts', __( 'You are not allowed to edit this item.' ) );
     1789        return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) );
    17901790    }
    17911791
Note: See TracChangeset for help on using the changeset viewer.