WordPress.org

Make WordPress Core

Changeset 33853


Ignore:
Timestamp:
09/02/15 16:20:46 (2 years ago)
Author:
SergeyBiryukov
Message:

Provide more helful feedback than just "Cheatin' uh?" for permission errors in wp-admin/media-upload.php.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/media-upload.php

    r31328 r33853  
    1616require_once( dirname( __FILE__ ) . '/admin.php' ); 
    1717 
    18 if (!current_user_can('upload_files')) 
    19     wp_die(__('You do not have permission to upload files.')); 
     18if ( ! current_user_can( 'upload_files' ) ) { 
     19    wp_die( __( 'You do not have permission to upload files.' ), 403 ); 
     20} 
    2021 
    2122wp_enqueue_script('plupload-handlers'); 
     
    3233 
    3334// Require an ID for the edit screen. 
    34 if ( isset($action) && $action == 'edit' && !$ID ) { 
    35     wp_die( __( 'Cheatin’ uh?' ), 403 ); 
     35if ( isset( $action ) && $action == 'edit' && !$ID ) { 
     36    wp_die( 
     37        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     38        '<p>' . __( 'Invalid item ID.' ) . '</p>', 
     39        403 
     40    ); 
    3641} 
    3742 
    3843if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) { 
    39     wp_die( __( 'Cheatin&#8217; uh?' ), 403 ); 
     44    wp_die( 
     45        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' . 
     46        '<p>' . __( 'You are not allowed to edit this item.' ) . '</p>', 
     47        403 
     48    ); 
    4049} 
    4150 
Note: See TracChangeset for help on using the changeset viewer.