Make WordPress Core

Changeset 42811


Ignore:
Timestamp:
03/09/2018 12:14:20 AM (7 years ago)
Author:
SergeyBiryukov
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, kristastevens for language; dmsnell for original patch; peterwilsoncc.
Merged [42648] and [42719] to the 4.9 branch.
Fixes #38332.

Location:
branches/4.9
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/custom-header.php

    r41937 r42811  
    720720        if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
    721721            wp_die(
    722                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     722                '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    723723                '<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
    724724                403
     
    878878        if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
    879879            wp_die(
    880                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     880                '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    881881                '<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
    882882                403
     
    886886        if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
    887887            wp_die(
    888                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     888                '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    889889                '<p>' . __( 'The current theme does not support a flexible sized header image.' ) . '</p>',
    890890                403
  • branches/4.9/src/wp-admin/customize.php

    r42535 r42811  
    1515if ( ! current_user_can( 'customize' ) ) {
    1616    wp_die(
    17         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     17        '<h1>' . __( 'You need a higher level of permission.' ) . '</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 need a higher level of permission.' ) . '</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>' . __( 'Something went wrong.' ) . '</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>',
  • branches/4.9/src/wp-admin/edit-comments.php

    r39600 r42811  
    1111if ( ! current_user_can( 'edit_posts' ) ) {
    1212    wp_die(
    13         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     13        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    1414        '<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>',
    1515        403
  • branches/4.9/src/wp-admin/edit-tags.php

    r41378 r42811  
    2424if ( ! current_user_can( $tax->cap->manage_terms ) ) {
    2525    wp_die(
    26         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     26        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    2727        '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
    2828        403
     
    7373    if ( ! current_user_can( $tax->cap->edit_terms ) ) {
    7474        wp_die(
    75             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     75            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    7676            '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
    7777            403
     
    9797    if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
    9898        wp_die(
    99             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     99            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    100100            '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
    101101            403
     
    117117    if ( ! current_user_can( $tax->cap->delete_terms ) ) {
    118118        wp_die(
    119             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     119            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    120120            '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
    121121            403
     
    153153    if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
    154154        wp_die(
    155             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     155            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    156156            '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    157157            403
  • branches/4.9/src/wp-admin/edit.php

    r39938 r42811  
    3737if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
    3838    wp_die(
    39         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     39        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    4040        '<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
    4141        403
  • branches/4.9/src/wp-admin/includes/bookmark.php

    r37914 r42811  
    2929    if ( ! current_user_can( 'manage_links' ) ) {
    3030        wp_die(
    31             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     31            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    3232            '<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
    3333            403
  • branches/4.9/src/wp-admin/includes/file.php

    r42245 r42811  
    590590
    591591            if ( ! isset( $result['message'] ) ) {
    592                 $message = __( 'An unidentified error has occurred.' );
     592                $message = __( 'Something went wrong.' );
    593593            } else {
    594594                $message = $result['message'];
  • branches/4.9/src/wp-admin/js/customize-controls.js

    r42623 r42811  
    68746874        cheatin: function() {
    68756875            $( document.body ).empty().addClass( 'cheatin' ).append(
    6876                 '<h1>' + api.l10n.cheatin + '</h1>' +
     6876                '<h1>' + api.l10n.notAllowedHeading + '</h1>' +
    68776877                '<p>' + api.l10n.notAllowed + '</p>'
    68786878            );
  • branches/4.9/src/wp-admin/media-upload.php

    r38307 r42811  
    3535if ( isset( $action ) && $action == 'edit' && !$ID ) {
    3636    wp_die(
    37         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     37        '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    3838        '<p>' . __( 'Invalid item ID.' ) . '</p>',
    3939        403
     
    4343if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) {
    4444    wp_die(
    45         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     45        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    4646        '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    4747        403
  • branches/4.9/src/wp-admin/nav-menus.php

    r41868 r42811  
    2222if ( ! current_user_can( 'edit_theme_options' ) ) {
    2323    wp_die(
    24         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     24        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    2525        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
    2626        403
  • branches/4.9/src/wp-admin/network/site-users.php

    r41652 r42811  
    155155                    if ( ! is_user_member_of_blog( $user_id ) ) {
    156156                        wp_die(
    157                             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     157                            '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    158158                            '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
    159159                            403
  • branches/4.9/src/wp-admin/options.php

    r42607 r42811  
    4747if ( ! current_user_can( $capability ) ) {
    4848    wp_die(
    49         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     49        '<h1>' . __( 'You need a higher level of permission.' ) . '</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 need a higher level of permission.' ) . '</h1>' .
    7878        '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
    7979        403
  • branches/4.9/src/wp-admin/post-new.php

    r41829 r42811  
    5757if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
    5858    wp_die(
    59         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     59        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    6060        '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>',
    6161        403
  • branches/4.9/src/wp-admin/press-this.php

    r41794 r42811  
    1919        wp_die(
    2020            __( 'Sorry, you are not allowed to create posts as this user.' ),
    21             __( 'Cheatin&#8217; uh?' ),
     21            __( 'You need a higher level of permission.' ),
    2222            403
    2323        );
  • branches/4.9/src/wp-admin/term.php

    r40655 r42811  
    3535) {
    3636    wp_die(
    37         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     37        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    3838        '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
    3939        403
  • branches/4.9/src/wp-admin/themes.php

    r41968 r42811  
    1212if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
    1313    wp_die(
    14         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     14        '<h1>' . __( 'You need a higher level of permission.' ) . '</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>' . __( 'Something went wrong.' ) . '</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 need a higher level of permission.' ) . '</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>' . __( 'Something went wrong.' ) . '</h1>' .
    5151                '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
    5252                403
  • branches/4.9/src/wp-admin/user-new.php

    r42264 r42811  
    1313    if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) {
    1414        wp_die(
    15             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     15            '<h1>' . __( 'You need a higher level of permission.' ) . '</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 need a higher level of permission.' ) . '</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 need a higher level of permission.' ) . '</h1>' .
    5656            '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
    5757            403
     
    119119    if ( ! current_user_can( 'create_users' ) ) {
    120120        wp_die(
    121             '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     121            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    122122            '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
    123123            403
  • branches/4.9/src/wp-admin/users.php

    r41566 r42811  
    1313if ( ! current_user_can( 'list_users' ) ) {
    1414    wp_die(
    15         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     15        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    1616        '<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>',
    1717        403
     
    131131        if ( is_multisite() && !is_user_member_of_blog( $id ) ) {
    132132            wp_die(
    133                 '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     133                '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
    134134                '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
    135135                403
  • branches/4.9/src/wp-admin/widgets.php

    r41621 r42811  
    1515if ( ! current_user_can( 'edit_theme_options' ) ) {
    1616    wp_die(
    17         '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     17        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    1818        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
    1919        403
  • branches/4.9/src/wp-includes/class-wp-customize-manager.php

    r42623 r42811  
    448448
    449449        if ( ! $message ) {
    450             $message = __( 'Cheatin&#8217; uh?' );
     450            $message = __( 'Something went wrong.' );
    451451        }
    452452
     
    513513            } else {
    514514                wp_die(
    515                     '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     515                    '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    516516                    '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
    517517                    403
  • branches/4.9/src/wp-includes/class-wp-xmlrpc-server.php

    r41980 r42811  
    36873687
    36883688        if ( ! $comment_ID ) {
    3689             return new IXR_Error( 403, __( 'An unidentified error has occurred.' ) );
     3689            return new IXR_Error( 403, __( 'Something went wrong.' ) );
    36903690        }
    36913691
  • branches/4.9/src/wp-includes/functions.php

    r42804 r42811  
    26052605        );
    26062606    } else {
    2607         $html = __( 'Are you sure you want to do this?' );
     2607        $html = __( 'The link you followed has expired.' );
    26082608        if ( wp_get_referer() ) {
    26092609            $html .= '</p><p>';
     
    26152615    }
    26162616
    2617     wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
     2617    wp_die( $html, __( 'Something went wrong.' ), 403 );
    26182618}
    26192619
  • branches/4.9/src/wp-includes/js/wp-ajax-response.js

    r39253 r42811  
    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: 'Something went wrong.' } );
    6060
    6161// Basic form validation
  • branches/4.9/src/wp-includes/script-loader.php

    r42548 r42811  
    131131    did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    132132        'noPerm' => __('Sorry, you are not allowed to do that.'),
    133         'broken' => __('An unidentified error has occurred.')
     133        'broken' => __('Something went wrong.')
    134134    ) );
    135135
     
    563563        'action'             => __( 'Action' ),
    564564        'discardChanges'     => __( 'Discard changes' ),
    565         'cheatin'            => __( 'Cheatin&#8217; uh?' ),
     565        'cheatin'            => __( 'Something went wrong.' ),
     566        'notAllowedHeading'  => __( 'You need a higher level of permission.' ),
    566567        'notAllowed'         => __( 'Sorry, you are not allowed to customize this site.' ),
    567568        'previewIframeTitle' => __( 'Site Preview' ),
     
    642643        did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
    643644            'noPerm' => __('Sorry, you are not allowed to do that.'),
    644             'broken' => __('An unidentified error has occurred.')
     645            'broken' => __('Something went wrong.')
    645646        ));
    646647
     
    836837                /* translators: %s: Importer name */
    837838                'activateImporterLabel'      => __( 'Run %s' ),
    838                 'unknownError'               => __( 'An unidentified error has occurred.' ),
     839                'unknownError'               => __( 'Something went wrong.' ),
    839840                'connectionError'            => __( 'Connection lost or the server is busy. Please try again later.' ),
    840841                'nonceError'                 => __( 'An error has occurred. Please reload the page and try again.' ),
Note: See TracChangeset for help on using the changeset viewer.