Redirect back to original referer when deleting a comment from the edit comment page. fixes #6458 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-21 16:45:48 +00:00
parent 6943482d3b
commit 8aa8fbfd28
2 changed files with 5 additions and 2 deletions

View File

@ -141,8 +141,10 @@ case 'deletecomment' :
else else
wp_delete_comment( $comment->comment_ID ); wp_delete_comment( $comment->comment_ID );
if ( '' != wp_get_referer() && false == $noredir ) if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ) )
wp_redirect( wp_get_referer() ); wp_redirect( wp_get_referer() );
else if ( '' != wp_get_original_referer() && false == $noredir )
wp_redirect( wp_get_original_referer() );
else else
wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' ); wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );

View File

@ -46,7 +46,7 @@ $time = mysql2date(get_option('time_format'), $comment->comment_date);
<p class="submit"> <p class="submit">
<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> <input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" />
<?php <?php
echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID", 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>";
?> ?>
</p> </p>
@ -95,6 +95,7 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" /> <input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" /> <input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" /> <input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
<?php wp_original_referer_field(true, 'previous'); ?>
<input type="hidden" name="noredir" value="1" /> <input type="hidden" name="noredir" value="1" />
</div> </div>
</div> </div>