From f51cb0a7c5532d5e255951f65654222aa5da3bbd Mon Sep 17 00:00:00 2001 From: whyisjake Date: Mon, 22 Jun 2020 23:53:09 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@48128 git-svn-id: http://core.svn.wordpress.org/trunk@47897 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/async-upload.php | 9 +++++---- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index 792fedcfd6..39f28a6237 100644 --- a/wp-admin/async-upload.php +++ b/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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index dffd371148..f7fbe3b06f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48127'; +$wp_version = '5.5-alpha-48128'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.