From 45f579edf59e08db7662a37b73ba2f6751284318 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 1 Dec 2008 18:02:16 +0000 Subject: [PATCH] Feedback for post and page deletions. fixes #8415 git-svn-id: http://svn.automattic.com/wordpress/trunk@9998 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-pages.php | 19 ++++++++++++++----- wp-admin/edit.php | 22 ++++++++++++++++------ wp-admin/page.php | 3 ++- wp-admin/post.php | 3 ++- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index bda3a4bfc4..e1b70638d1 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -17,6 +17,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] case 'delete': if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) { check_admin_referer('bulk-pages'); + $deleted = 0; foreach( (array) $_GET['post'] as $post_id_del ) { $post_del = & get_post($post_id_del); @@ -30,6 +31,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] if ( !wp_delete_post($post_id_del) ) wp_die( __('Error in deleting...') ); } + $deleted++; } } break; @@ -58,6 +60,8 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] $done['locked'] = count( $done['locked'] ); $sendback = add_query_arg( $done, $sendback ); } + if ( isset($deleted) ) + $sendback = add_query_arg('deleted', $deleted, $sendback); wp_redirect($sendback); exit(); } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { @@ -102,23 +106,28 @@ require_once('admin-header.php'); ?>

- +

-

diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 8e1cad3c48..83232f7459 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -25,6 +25,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] case 'delete': if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) { check_admin_referer('bulk-posts'); + $deleted = 0; foreach( (array) $_GET['post'] as $post_id_del ) { $post_del = & get_post($post_id_del); @@ -38,6 +39,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] if ( !wp_delete_post($post_id_del) ) wp_die( __('Error in deleting...') ); } + $deleted++; } } break; @@ -66,6 +68,8 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] $done['locked'] = count( $done['locked'] ); $sendback = add_query_arg( $done, $sendback ); } + if ( isset($deleted) ) + $sendback = add_query_arg('deleted', $deleted, $sendback); wp_redirect($sendback); exit(); } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { @@ -100,21 +104,27 @@ if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET - +

-

diff --git a/wp-admin/page.php b/wp-admin/page.php index 90992d9bc4..97b28b9b23 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -170,8 +170,9 @@ case 'delete': } $sendback = wp_get_referer(); - if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php'); + if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit-pages.php?deleted=1'); elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); + else $sendback = add_query_arg('deleted', 1, $sendback); wp_redirect($sendback); exit(); break; diff --git a/wp-admin/post.php b/wp-admin/post.php index 17b2b05fbc..af8e081394 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -211,8 +211,9 @@ case 'delete': } $sendback = wp_get_referer(); - if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php'); + if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?deleted=1'); elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); + else $sendback = add_query_arg('deleted', 1, $sendback); wp_redirect($sendback); exit(); break;