WordPress.org

Make WordPress Core

Changeset 33884


Ignore:
Timestamp:
09/03/15 08:44:37 (2 years ago)
Author:
SergeyBiryukov
Message:

Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/user-new.php.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-new.php

    r33774 r33884  
    1111 
    1212if ( is_multisite() ) { 
    13     if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) 
    14         wp_die( __( 'Cheatin’ uh?' ), 403 ); 
     13    if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) { 
     14        wp_die( 
     15            '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     16            '<p>' . __( 'You do not have sufficient permissions to add users to this network.' ) . '</p>', 
     17            403 
     18        ); 
     19    } 
    1520} elseif ( ! current_user_can( 'create_users' ) ) { 
    16     wp_die( __( 'Cheatin&#8217; uh?' ), 403 ); 
     21    wp_die( 
     22        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     23        '<p>' . __( 'You are not allowed to create users.' ) . '</p>', 
     24        403 
     25    ); 
    1726} 
    1827 
     
    6069    } 
    6170 
    62     if ( ! current_user_can('promote_user', $user_details->ID) ) 
    63         wp_die( __( 'Cheatin&#8217; uh?' ), 403 ); 
     71    if ( ! current_user_can( 'promote_user', $user_details->ID ) ) { 
     72        wp_die( 
     73            '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     74            '<p>' . __( 'You do not have sufficient permissions to add users to this network.' ) . '</p>', 
     75            403 
     76        ); 
     77    } 
    6478 
    6579    // Adding an existing user to this blog 
     
    109123    check_admin_referer( 'create-user', '_wpnonce_create-user' ); 
    110124 
    111     if ( ! current_user_can('create_users') ) 
    112         wp_die( __( 'Cheatin&#8217; uh?' ), 403 ); 
     125    if ( ! current_user_can( 'create_users' ) ) { 
     126        wp_die( 
     127            '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     128            '<p>' . __( 'You are not allowed to create users.' ) . '</p>', 
     129            403 
     130        ); 
     131    } 
    113132 
    114133    if ( ! is_multisite() ) { 
Note: See TracChangeset for help on using the changeset viewer.