From 092c34944306c08de88bf74654b470fb1b27fbe1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov <sergeybiryukov.ru@gmail.com> Date: Tue, 9 Sep 2014 09:50:15 +0000 Subject: [PATCH] Don't display Edit links for attachments user cannot edit. props skaeser. fixes #29596 for trunk. Built from https://develop.svn.wordpress.org/trunk@29723 git-svn-id: http://core.svn.wordpress.org/trunk@29497 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media-template.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 8a038337e2..14e78f5cb7 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -312,7 +312,7 @@ function wp_print_media_templates() { <# } #> <div class="attachment-actions"> - <# if ( 'image' === data.type && ! data.uploading && data.sizes ) { #> + <# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #> <a class="button edit-attachment" href="#"><?php _e( 'Edit Image' ); ?></a> <# } #> </div> @@ -408,19 +408,21 @@ function wp_print_media_templates() { </div> <div class="actions"> - <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> | - <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a> + <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> + <# if ( data.can.save ) { #> | + <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a> + <# } #> <# if ( ! data.uploading && data.can.remove ) { #> | - <?php if ( MEDIA_TRASH ): ?> + <?php if ( MEDIA_TRASH ): ?> <# if ( 'trash' === data.status ) { #> <a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a> <# } else { #> <a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a> <# } #> - <?php else: ?> - <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a> - <?php endif; ?> - <# } #> + <?php else: ?> + <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a> + <?php endif; ?> + <# } #> </div> </div>