Make WordPress Core

Changeset 42648


Ignore:
Timestamp:
02/05/2018 02:29:53 AM (7 years ago)
Author:
peterwilsoncc
Message:

General: Replace Cheatin’ uh? with friendlier error messages.

While intended as a playful error message, Cheatin’ uh? can be interpreted as insulting or accusatory in an already stressful situation. This replaces Cheatin’ with more meaningful error messages, depending on the error that occurs.

Props ElectricFeet, EricMeyer, karmatosed, dd32, BandonRandon, melchoyce for language; dmsnell for original patch; peterwilsoncc.
Fixes #38332.

Location:
trunk/src
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/custom-header.php

    r42343 r42648  
    759759        if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
    760760            wp_die(
    761                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     761                '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    762762                '<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
    763763                403
     
    923923        if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
    924924            wp_die(
    925                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     925                '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    926926                '<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
    927927                403
     
    931931        if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
    932932            wp_die(
    933                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     933                '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    934934                '<p>' . __( 'The current theme does not support a flexible sized header image.' ) . '</p>',
    935935                403
  • trunk/src/wp-admin/customize.php

    r42343 r42648  
    1515if ( ! current_user_can( 'customize' ) ) {
    1616    wp_die(
    17         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     17        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1818        '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
    1919        403
     
    3232    if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
    3333        wp_die(
    34             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     34            '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    3535            '<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
    3636            403
     
    7777    if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
    7878        wp_die(
    79             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     79            '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    8080            '<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
    8181            '<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
  • trunk/src/wp-admin/edit-comments.php

    r42343 r42648  
    1111if ( ! current_user_can( 'edit_posts' ) ) {
    1212    wp_die(
    13         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     13        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1414        '<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>',
    1515        403
  • trunk/src/wp-admin/edit-tags.php

    r42343 r42648  
    2626if ( ! current_user_can( $tax->cap->manage_terms ) ) {
    2727    wp_die(
    28         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     28        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    2929        '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
    3030        403
     
    8282        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
    8383            wp_die(
    84                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     84                '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    8585                '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
    8686                403
     
    112112        if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
    113113            wp_die(
    114                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     114                '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    115115                '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
    116116                403
     
    132132        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
    133133            wp_die(
    134                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     134                '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    135135                '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
    136136                403
     
    168168        if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
    169169            wp_die(
    170                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     170                '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    171171                '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    172172                403
  • trunk/src/wp-admin/edit.php

    r42343 r42648  
    3939if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
    4040    wp_die(
    41         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     41        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    4242        '<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
    4343        403
  • trunk/src/wp-admin/includes/bookmark.php

    r42343 r42648  
    2929    if ( ! current_user_can( 'manage_links' ) ) {
    3030        wp_die(
    31             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     31            '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    3232            '<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
    3333            403
  • trunk/src/wp-admin/includes/file.php

    r42525 r42648  
    592592
    593593            if ( ! isset( $result['message'] ) ) {
    594                 $message = __( 'An unidentified error has occurred.' );
     594                $message = __( 'An error has occurred.' );
    595595            } else {
    596596                $message = $result['message'];
  • trunk/src/wp-admin/js/customize-controls.js

    r42612 r42648  
    68376837        cheatin: function() {
    68386838            $( document.body ).empty().addClass( 'cheatin' ).append(
    6839                 '<h1>' + api.l10n.cheatin + '</h1>' +
     6839                '<h1>' + api.l10n.notAllowedHeading + '</h1>' +
    68406840                '<p>' + api.l10n.notAllowed + '</p>'
    68416841            );
  • trunk/src/wp-admin/media-upload.php

    r42343 r42648  
    3636if ( isset( $action ) && $action == 'edit' && ! $ID ) {
    3737    wp_die(
    38         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     38        '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    3939        '<p>' . __( 'Invalid item ID.' ) . '</p>',
    4040        403
     
    4444if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post', $_REQUEST['post_id'] ) ) {
    4545    wp_die(
    46         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     46        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    4747        '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    4848        403
  • trunk/src/wp-admin/nav-menus.php

    r42343 r42648  
    2323if ( ! current_user_can( 'edit_theme_options' ) ) {
    2424    wp_die(
    25         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     25        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    2626        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
    2727        403
  • trunk/src/wp-admin/network/site-users.php

    r42343 r42648  
    160160                    if ( ! is_user_member_of_blog( $user_id ) ) {
    161161                        wp_die(
    162                             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     162                            '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    163163                            '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
    164164                            403
  • trunk/src/wp-admin/options.php

    r42606 r42648  
    4747if ( ! current_user_can( $capability ) ) {
    4848    wp_die(
    49         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     49        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    5050        '<p>' . __( 'Sorry, you are not allowed to manage these options.' ) . '</p>',
    5151        403
     
    7575if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) {
    7676    wp_die(
    77         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     77        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    7878        '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
    7979        403
  • trunk/src/wp-admin/post-new.php

    r42343 r42648  
    5858if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
    5959    wp_die(
    60         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     60        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    6161        '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>',
    6262        403
  • trunk/src/wp-admin/press-this.php

    r42343 r42648  
    1919        wp_die(
    2020            __( 'Sorry, you are not allowed to create posts as this user.' ),
    21             __( 'Cheatin&#8217; uh?' ),
     21            __( 'You don&#8217;t have permission to do this.' ),
    2222            403
    2323        );
  • trunk/src/wp-admin/term.php

    r42343 r42648  
    3535
    3636    wp_die(
    37         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     37        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    3838        '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    3939        403
  • trunk/src/wp-admin/themes.php

    r42343 r42648  
    1212if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
    1313    wp_die(
    14         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     14        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1515        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
    1616        403
     
    2525        if ( ! $theme->exists() || ! $theme->is_allowed() ) {
    2626            wp_die(
    27                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     27                '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    2828                '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
    2929                403
     
    4040        if ( ! current_user_can( 'delete_themes' ) ) {
    4141            wp_die(
    42                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     42                '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    4343                '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
    4444                403
     
    4848        if ( ! $theme->exists() ) {
    4949            wp_die(
    50                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     50                '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    5151                '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
    5252                403
  • trunk/src/wp-admin/user-new.php

    r42343 r42648  
    1313    if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) {
    1414        wp_die(
    15             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     15            '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1616            '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
    1717            403
     
    2020} elseif ( ! current_user_can( 'create_users' ) ) {
    2121    wp_die(
    22         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     22        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    2323        '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
    2424        403
     
    5353    if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
    5454        wp_die(
    55             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     55            '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    5656            '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
    5757            403
     
    137137    if ( ! current_user_can( 'create_users' ) ) {
    138138        wp_die(
    139             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     139            '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    140140            '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
    141141            403
  • trunk/src/wp-admin/users.php

    r42343 r42648  
    1313if ( ! current_user_can( 'list_users' ) ) {
    1414    wp_die(
    15         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     15        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1616        '<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>',
    1717        403
     
    142142            if ( is_multisite() && ! is_user_member_of_blog( $id ) ) {
    143143                wp_die(
    144                     '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     144                    '<h1>' . __( 'An error has occurred.' ) . '</h1>' .
    145145                    '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
    146146                    403
  • trunk/src/wp-admin/widgets.php

    r42343 r42648  
    1515if ( ! current_user_can( 'edit_theme_options' ) ) {
    1616    wp_die(
    17         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     17        '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    1818        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
    1919        403
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r42632 r42648  
    448448
    449449        if ( ! $message ) {
    450             $message = __( 'Cheatin&#8217; uh?' );
     450            $message = __( 'An error has occurred.' );
    451451        }
    452452
     
    513513            } else {
    514514                wp_die(
    515                     '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     515                    '<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
    516516                    '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
    517517                    403
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r42343 r42648  
    38803880
    38813881        if ( ! $comment_ID ) {
    3882             return new IXR_Error( 403, __( 'An unidentified error has occurred.' ) );
     3882            return new IXR_Error( 403, __( 'An error has occurred.' ) );
    38833883        }
    38843884
  • trunk/src/wp-includes/functions.php

    r42570 r42648  
    27192719        );
    27202720    } else {
    2721         $html = __( 'Are you sure you want to do this?' );
     2721        $html = __( 'The link you followed no longer exists.' );
    27222722        if ( wp_get_referer() ) {
    27232723            $html .= '</p><p>';
     
    27302730    }
    27312731
    2732     wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
     2732    wp_die( $html, __( 'An error has occurred.' ), 403 );
    27332733}
    27342734
  • trunk/src/wp-includes/js/wp-ajax-response.js

    r39253 r42648  
    5757        return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() === ''; } ) ).length;
    5858    }
    59 }, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'An unidentified error has occurred.' } );
     59}, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'An error has occurred.' } );
    6060
    6161// Basic form validation
  • trunk/src/wp-includes/script-loader.php

    r42616 r42648  
    138138        'wp-ajax-response', 'wpAjax', array(
    139139            'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
    140             'broken' => __( 'An unidentified error has occurred.' ),
     140            'broken' => __( 'An error has occurred.' ),
    141141        )
    142142    );
     
    606606            'action'                  => __( 'Action' ),
    607607            'discardChanges'          => __( 'Discard changes' ),
    608             'cheatin'                 => __( 'Cheatin&#8217; uh?' ),
     608            'cheatin'                 => __( 'An error has occurred.' ),
     609            'notAllowedHeading'       => __( 'You don&#8217;t have permission to do this.' ),
    609610            'notAllowed'              => __( 'Sorry, you are not allowed to customize this site.' ),
    610611            'previewIframeTitle'      => __( 'Site Preview' ),
     
    689690            'admin-tags', 'tagsl10n', array(
    690691                'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
    691                 'broken' => __( 'An unidentified error has occurred.' ),
     692                'broken' => __( 'An error has occurred.' ),
    692693            )
    693694        );
     
    918919                    /* translators: %s: Importer name */
    919920                    'activateImporterLabel'    => __( 'Run %s' ),
    920                     'unknownError'             => __( 'An unidentified error has occurred.' ),
     921                    'unknownError'             => __( 'An error has occurred.' ),
    921922                    'connectionError'          => __( 'Connection lost or the server is busy. Please try again later.' ),
    922923                    'nonceError'               => __( 'An error has occurred. Please reload the page and try again.' ),
Note: See TracChangeset for help on using the changeset viewer.