Only show Delete in media modal if the user can delete.
Props nacin, koopersmith fixes #22711 git-svn-id: http://core.svn.wordpress.org/trunk@23032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1334,11 +1334,17 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||
'icon' => wp_mime_type_icon( $attachment->ID ),
|
||||
'dateFormatted' => mysql2date( get_option('date_format'), $attachment->post_date ),
|
||||
'nonces' => array(
|
||||
'update' => wp_create_nonce( 'update-post_' . $attachment->ID ),
|
||||
'delete' => wp_create_nonce( 'delete-post_' . $attachment->ID ),
|
||||
'update' => false,
|
||||
'delete' => false,
|
||||
),
|
||||
);
|
||||
|
||||
if ( current_user_can( 'edit_post', $attachment->ID ) )
|
||||
$response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
|
||||
|
||||
if ( current_user_can( 'delete_post', $attachment->ID ) )
|
||||
$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
|
||||
|
||||
if ( $meta && 'image' === $type ) {
|
||||
$sizes = array();
|
||||
$possible_sizes = apply_filters( 'image_size_names_choose', array(
|
||||
@@ -1690,7 +1696,7 @@ function wp_print_media_templates() {
|
||||
<# if ( 'image' === data.type && ! data.uploading && data.width && data.height ) { #>
|
||||
<div class="dimensions">{{ data.width }} × {{ data.height }}</div>
|
||||
<# } #>
|
||||
<# if ( ! data.uploading ) { #>
|
||||
<# if ( ! data.uploading && data.can.remove ) { #>
|
||||
<div class="delete-attachment">
|
||||
<a href="#"><?php _e( 'Delete Permanently' ); ?></a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user