mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Feedback for post and page deletions. fixes #8415
git-svn-id: http://svn.automattic.com/wordpress/trunk@9998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f8f2ff942d
commit
45f579edf5
@ -17,6 +17,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2']
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
|
if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
|
||||||
check_admin_referer('bulk-pages');
|
check_admin_referer('bulk-pages');
|
||||||
|
$deleted = 0;
|
||||||
foreach( (array) $_GET['post'] as $post_id_del ) {
|
foreach( (array) $_GET['post'] as $post_id_del ) {
|
||||||
$post_del = & get_post($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) )
|
if ( !wp_delete_post($post_id_del) )
|
||||||
wp_die( __('Error in deleting...') );
|
wp_die( __('Error in deleting...') );
|
||||||
}
|
}
|
||||||
|
$deleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -58,6 +60,8 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2']
|
|||||||
$done['locked'] = count( $done['locked'] );
|
$done['locked'] = count( $done['locked'] );
|
||||||
$sendback = add_query_arg( $done, $sendback );
|
$sendback = add_query_arg( $done, $sendback );
|
||||||
}
|
}
|
||||||
|
if ( isset($deleted) )
|
||||||
|
$sendback = add_query_arg('deleted', $deleted, $sendback);
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
exit();
|
||||||
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
|
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
|
||||||
@ -102,23 +106,28 @@ require_once('admin-header.php'); ?>
|
|||||||
<?php screen_icon(); ?>
|
<?php screen_icon(); ?>
|
||||||
<h2><?php echo wp_specialchars( $title ); ?></h2>
|
<h2><?php echo wp_specialchars( $title ); ?></h2>
|
||||||
|
|
||||||
<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) ) { ?>
|
<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
|
||||||
<div id="message" class="updated fade"><p>
|
<div id="message" class="updated fade"><p>
|
||||||
<?php if ( (int) $_GET['updated'] ) {
|
<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
|
||||||
printf( __ngettext( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
printf( __ngettext( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
||||||
unset($_GET['updated']);
|
unset($_GET['updated']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (int) $_GET['skipped'] ) {
|
if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
|
||||||
printf( __ngettext( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
|
printf( __ngettext( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
|
||||||
unset($_GET['skipped']);
|
unset($_GET['skipped']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (int) $_GET['locked'] ) {
|
if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
|
||||||
printf( __ngettext( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
|
printf( __ngettext( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
|
||||||
unset($_GET['locked']);
|
unset($_GET['locked']);
|
||||||
}
|
}
|
||||||
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated'), $_SERVER['REQUEST_URI'] );
|
|
||||||
|
if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
|
||||||
|
printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
|
||||||
|
unset($_GET['deleted']);
|
||||||
|
}
|
||||||
|
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
|
||||||
?>
|
?>
|
||||||
</p></div>
|
</p></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -25,6 +25,7 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2']
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
|
if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
|
||||||
check_admin_referer('bulk-posts');
|
check_admin_referer('bulk-posts');
|
||||||
|
$deleted = 0;
|
||||||
foreach( (array) $_GET['post'] as $post_id_del ) {
|
foreach( (array) $_GET['post'] as $post_id_del ) {
|
||||||
$post_del = & get_post($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) )
|
if ( !wp_delete_post($post_id_del) )
|
||||||
wp_die( __('Error in deleting...') );
|
wp_die( __('Error in deleting...') );
|
||||||
}
|
}
|
||||||
|
$deleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -66,6 +68,8 @@ if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2']
|
|||||||
$done['locked'] = count( $done['locked'] );
|
$done['locked'] = count( $done['locked'] );
|
||||||
$sendback = add_query_arg( $done, $sendback );
|
$sendback = add_query_arg( $done, $sendback );
|
||||||
}
|
}
|
||||||
|
if ( isset($deleted) )
|
||||||
|
$sendback = add_query_arg('deleted', $deleted, $sendback);
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
exit();
|
||||||
} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
|
} 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
|
|||||||
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
|
<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
|
||||||
endif; ?>
|
endif; ?>
|
||||||
|
|
||||||
<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) ) { ?>
|
<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
|
||||||
<div id="message" class="updated fade"><p>
|
<div id="message" class="updated fade"><p>
|
||||||
<?php if ( (int) $_GET['updated'] ) {
|
<?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
|
||||||
printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
|
||||||
unset($_GET['updated']);
|
unset($_GET['updated']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (int) $_GET['skipped'] )
|
if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
|
||||||
unset($_GET['skipped']);
|
unset($_GET['skipped']);
|
||||||
|
|
||||||
if ( (int) $_GET['locked'] ) {
|
if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
|
||||||
printf( __ngettext( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
|
printf( __ngettext( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
|
||||||
unset($_GET['locked']);
|
unset($_GET['locked']);
|
||||||
}
|
}
|
||||||
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated'), $_SERVER['REQUEST_URI'] );
|
|
||||||
|
if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
|
||||||
|
printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
|
||||||
|
unset($_GET['deleted']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
|
||||||
?>
|
?>
|
||||||
</p></div>
|
</p></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -170,8 +170,9 @@ case 'delete':
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sendback = wp_get_referer();
|
$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');
|
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||||
|
else $sendback = add_query_arg('deleted', 1, $sendback);
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
exit();
|
||||||
break;
|
break;
|
||||||
|
@ -211,8 +211,9 @@ case 'delete':
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sendback = wp_get_referer();
|
$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');
|
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||||
|
else $sendback = add_query_arg('deleted', 1, $sendback);
|
||||||
wp_redirect($sendback);
|
wp_redirect($sendback);
|
||||||
exit();
|
exit();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user