diff --git a/src/wp-admin/async-upload.php b/src/wp-admin/async-upload.php index 792fedcfd6..39f28a6237 100644 --- a/src/wp-admin/async-upload.php +++ b/src/wp-admin/async-upload.php @@ -45,9 +45,6 @@ if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) if ( 'attachment' !== $post->post_type ) { wp_die( __( 'Invalid post type.' ) ); } - if ( ! current_user_can( 'edit_post', $id ) ) { - wp_die( __( 'Sorry, you are not allowed to edit this item.' ) ); - } switch ( $_REQUEST['fetch'] ) { case 3: @@ -55,7 +52,11 @@ if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) if ( $thumb_url ) { echo ''; } - echo '' . _x( 'Edit', 'media item' ) . ''; + if ( current_user_can( 'edit_post', $id ) ) { + echo '' . _x( 'Edit', 'media item' ) . ''; + } else { + echo '' . _x( 'Success', 'media item' ) . ''; + } // Title shouldn't ever be empty, but use filename just in case. $file = get_attached_file( $post->ID );