Fix action on dashboard spam link, merge deletecomment with trashcomment, untrashcomment, spamcomment, and unspamcomment, props caesarsgrunt, fixes #11432
git-svn-id: http://svn.automattic.com/wordpress/trunk@12401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
061e5ff77d
commit
6769f5d7e8
|
@ -137,35 +137,6 @@ if ( 'spam' == $_GET['dt'] ) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'deletecomment' :
|
case 'deletecomment' :
|
||||||
$comment_id = absint( $_REQUEST['c'] );
|
|
||||||
check_admin_referer( 'delete-comment_' . $comment_id );
|
|
||||||
|
|
||||||
if ( isset( $_REQUEST['noredir'] ) )
|
|
||||||
$noredir = true;
|
|
||||||
else
|
|
||||||
$noredir = false;
|
|
||||||
|
|
||||||
if ( !$comment = get_comment( $comment_id ) )
|
|
||||||
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
|
|
||||||
|
|
||||||
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
|
||||||
comment_footer_die( __('You are not allowed to edit comments on this post.') );
|
|
||||||
|
|
||||||
if ( 'spam' == $_REQUEST['dt'] )
|
|
||||||
wp_set_comment_status( $comment->comment_ID, 'spam' );
|
|
||||||
else
|
|
||||||
wp_delete_comment( $comment->comment_ID );
|
|
||||||
|
|
||||||
if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ) )
|
|
||||||
wp_redirect( wp_get_referer() );
|
|
||||||
else if ( '' != wp_get_original_referer() && false == $noredir )
|
|
||||||
wp_redirect( wp_get_original_referer() );
|
|
||||||
else
|
|
||||||
wp_redirect( admin_url('edit-comments.php') );
|
|
||||||
|
|
||||||
die;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'trashcomment' :
|
case 'trashcomment' :
|
||||||
case 'untrashcomment' :
|
case 'untrashcomment' :
|
||||||
case 'spamcomment' :
|
case 'spamcomment' :
|
||||||
|
@ -190,6 +161,10 @@ case 'unspamcomment' :
|
||||||
$redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir );
|
$redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir );
|
||||||
|
|
||||||
switch ( $action ) {
|
switch ( $action ) {
|
||||||
|
case 'deletecomment' :
|
||||||
|
wp_delete_comment($comment_id);
|
||||||
|
$redir = add_query_arg( array('deleted' => '1'), $redir );
|
||||||
|
break;
|
||||||
case 'trashcomment' :
|
case 'trashcomment' :
|
||||||
wp_trash_comment($comment_id);
|
wp_trash_comment($comment_id);
|
||||||
$redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir );
|
$redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir );
|
||||||
|
|
|
@ -545,7 +545,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
|
|
||||||
$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
$spam_url = esc_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
$spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue