From 7d116a2ae424bc78460867b9dcc831279f543883 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 14 Nov 2008 18:23:48 +0000 Subject: [PATCH] Check caps when showing media edit and delete links. fixes #8117 git-svn-id: https://develop.svn.wordpress.org/trunk@9686 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upload.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 2190c138d4..e52bab8771 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -337,10 +337,13 @@ foreach ($arc_result as $arc_row) {

ID, true) . '">' . __('Edit') . ''; - $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + if ( current_user_can('edit_post', $post->ID) ) + $actions['edit'] = '' . __('Edit') . ''; + if ( current_user_can('delete_post', $post->ID) ) + $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; $actions['view'] = '' . __('View') . ''; - $actions['attach'] = ''.__('Attach').''; + if ( current_user_can('edit_post', $post->ID) ) + $actions['attach'] = ''.__('Attach').''; $action_count = count($actions); $i = 0; foreach ( $actions as $action => $link ) {