From da4c482270baf7c84587536e395a05b6830c695a Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 12 Jun 2009 13:42:07 +0000 Subject: [PATCH] Check delete caps for delete action links. Props johnbillion. fixes #10121 for 2.8 git-svn-id: http://svn.automattic.com/wordpress/branches/2.8@11556 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 13faf1063b..f47e56bee6 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1447,6 +1447,8 @@ function _post_row($a_post, $pending_comments, $mode) { if ( current_user_can('edit_post', $post->ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; + } + if ( current_user_can('delete_post', $post->ID) ) { $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) { @@ -1660,6 +1662,8 @@ foreach ($posts_columns as $column_name=>$column_display_name) { if ( current_user_can('edit_page', $page->ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline'] = '' . __('Quick Edit') . ''; + } + if ( current_user_can('delete_page', $page->ID) ) { $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) {