Make WordPress Core

Changeset 48128


Ignore:
Timestamp:
06/22/2020 11:51:09 PM (6 years ago)
Author:
whyisjake
Message:

Media: Ensure that uploaded images get a success notification by users with upload_files capability.

There was an early wp_die that was preventing the success notification from being sent in the upload process.

Fixes #44581.

Props pbiron, mikeschroder, joemcgill, rebasaurus, whyisjake.

File:
1 edited

Legend:

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

    r47785 r48128  
    4646                wp_die( __( 'Invalid post type.' ) );
    4747        }
    48         if ( ! current_user_can( 'edit_post', $id ) ) {
    49                 wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
    50         }
    5148
    5249        switch ( $_REQUEST['fetch'] ) {
     
    5653                                echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
    5754                        }
    58                         echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
     55                        if ( current_user_can( 'edit_post', $id ) ) {
     56                                echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
     57                        } else {
     58                                echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
     59                        }
    5960
    6061                        // Title shouldn't ever be empty, but use filename just in case.
Note: See TracChangeset for help on using the changeset viewer.