Redirect correctly on page deletion. Fixes #8030.

git-svn-id: http://svn.automattic.com/wordpress/trunk@9468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-11-01 22:28:34 +00:00
parent 400296cdef
commit 5c7a4d7693
2 changed files with 3 additions and 3 deletions

View File

@ -179,8 +179,8 @@ switch ( $post->post_status ) {
<?php do_action('post_submitbox_start'); ?> <?php do_action('post_submitbox_start'); ?>
<div id="delete-action"> <div id="delete-action">
<?php <?php
if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?> if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(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 page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> <a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(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 page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
<?php } ?> <?php } ?>
</div> </div>

View File

@ -166,7 +166,7 @@ case 'delete':
} }
$sendback = wp_get_referer(); $sendback = wp_get_referer();
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page.php'); if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback); wp_redirect($sendback);