Make WordPress Core

Changeset 33852


Ignore:
Timestamp:
09/02/2015 04:05:07 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Provide more helful feedback than just “Cheatin’ uh?” for permission errors in wp-admin/edit-tags.php.

props ericlewis, kraftbj, lukecarbis, mrmist.
fixes #33670. see #14530.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tags.php

    r33641 r33852  
    1818        wp_die( __( 'Invalid taxonomy' ) );
    1919
    20 if ( ! current_user_can( $tax->cap->manage_terms ) )
    21         wp_die( __( 'Cheatin’ uh?' ), 403 );
     20if ( ! current_user_can( $tax->cap->manage_terms ) ) {
     21        wp_die(
     22                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     23                '<p>' . __( 'You are not allowed to manage these items.' ) . '</p>',
     24                403
     25        );
     26}
    2227
    2328/**
    … …  
    5459        check_admin_referer( 'add-tag', '_wpnonce_add-tag' );
    5560
    56         if ( !current_user_can( $tax->cap->edit_terms ) )
    57                 wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
     61        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
     62                wp_die(
     63                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     64                        '<p>' . __( 'You are not allowed to add this item.' ) . '</p>',
     65                        403
     66                );
     67        }
    5868
    5969        $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
    … …  
    90100        check_admin_referer( 'delete-tag_' . $tag_ID );
    91101
    92         if ( !current_user_can( $tax->cap->delete_terms ) )
    93                 wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
     102        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
     103                wp_die(
     104                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     105                        '<p>' . __( 'You are not allowed to delete this item.' ) . '</p>',
     106                        403
     107                );
     108        }
    94109
    95110        wp_delete_term( $tag_ID, $taxonomy );
    … …  
    102117        check_admin_referer( 'bulk-tags' );
    103118
    104         if ( !current_user_can( $tax->cap->delete_terms ) )
    105                 wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
     119        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
     120                wp_die(
     121                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     122                        '<p>' . __( 'You are not allowed to delete these items.' ) . '</p>',
     123                        403
     124                );
     125        }
    106126
    107127        $tags = (array) $_REQUEST['delete_tags'];
    … …  
    140160        check_admin_referer( 'update-tag_' . $tag_ID );
    141161
    142         if ( !current_user_can( $tax->cap->edit_terms ) )
    143                 wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
     162        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
     163                wp_die(
     164                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     165                        '<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
     166                        403
     167                );
     168        }
    144169
    145170        $tag = get_term( $tag_ID, $taxonomy );
    … …  
    253278require_once( ABSPATH . 'wp-admin/admin-header.php' );
    254279
    255 if ( !current_user_can($tax->cap->edit_terms) )
    256         wp_die( __('You are not allowed to edit this item.') );
     280if ( ! current_user_can( $tax->cap->edit_terms ) ) {
     281        wp_die(
     282                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
     283                '<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
     284                403
     285        );
     286}
    257287
    258288$messages = array();
Note: See TracChangeset for help on using the changeset viewer.