1
0
mirror of https://github.com/WordPress/WordPress.git synced 2025-03-10 13:49:12 +01:00

Fix trashing/untrashing comments when no JS, props caesarsgrunt, see

git-svn-id: http://svn.automattic.com/wordpress/trunk@12113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-10-27 03:46:31 +00:00
parent a4996245ec
commit 195e473fe4
2 changed files with 18 additions and 15 deletions

View File

@ -176,28 +176,31 @@ case 'untrashcomment' :
if ( !current_user_can('edit_post', $comment->comment_post_ID ) ) if ( !current_user_can('edit_post', $comment->comment_post_ID ) )
comment_footer_die( __('You are not allowed to edit comments on this post.') ); comment_footer_die( __('You are not allowed to edit comments on this post.') );
if ($action == 'trashcomment') { check_admin_referer( 'delete-comment_' . $comment_id );
check_admin_referer( 'trash-comment_' . $comment_id );
wp_trash_comment($comment_id);
}
else {
check_admin_referer( 'untrash-comment_' . $comment_id );
wp_untrash_comment($comment_id);
}
if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php') ) if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php') )
wp_redirect( wp_get_referer() ); $redir = wp_get_referer();
elseif ( '' != wp_get_original_referer() && false == $noredir ) elseif ( '' != wp_get_original_referer() && false == $noredir )
wp_redirect(wp_get_original_referer()); $redir = wp_get_original_referer();
else else
wp_redirect(admin_url('edit-comments.php')); $redir = admin_url('edit-comments.php');
if ( $action == 'trashcomment' ) {
wp_trash_comment($comment_id);
$redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir );
} else {
wp_untrash_comment($comment_id);
$redir = add_query_arg( array('untrashed' => '1'), $redir );
}
wp_redirect( $redir );
die; die;
break; break;
case 'unapprovecomment' : case 'unapprovecomment' :
$comment_id = absint( $_GET['c'] ); $comment_id = absint( $_GET['c'] );
check_admin_referer( 'unapprove-comment_' . $comment_id ); check_admin_referer( 'approve-comment_' . $comment_id );
if ( isset( $_GET['noredir'] ) ) if ( isset( $_GET['noredir'] ) )
$noredir = true; $noredir = true;

View File

@ -68,7 +68,7 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
<div id="major-publishing-actions"> <div id="major-publishing-actions">
<div id="delete-action"> <div id="delete-action">
<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=trashcomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'trash-comment_' . $comment->comment_ID) . "'>" . __('Move to Trash') . "</a>\n"; ?> <?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=trashcomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . __('Move to Trash') . "</a>\n"; ?>
</div> </div>
<div id="publishing-action"> <div id="publishing-action">
<input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" /> <input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" />