diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 32ec092aea..1a5acdd470 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -43,13 +43,21 @@ if ( !empty( $_POST['delete_comments'] ) ) : foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each $comment = (int) $comment; $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); - $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); - if ( current_user_can('edit_post', $post_id) ) : - wp_set_comment_status($comment, "delete"); + // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); + if ( current_user_can('edit_post', $post_id) ) { + if ( !empty( $_POST['spam_button'] ) ) + wp_set_comment_status($comment, 'spam'); + else + wp_set_comment_status($comment, 'delete'); ++$i; - endif; + } endforeach; - echo "
" . sprintf(__('%s comments deleted.'), $i) . "
'; + if ( !empty( $_POST['spam_button'] ) ) + printf(__('%s comments marked as spam.'), $i); + else + printf(__('%s comments deleted.'), $i); + echo '
comment_post_ID) ) { echo " | comment_ID."\">" . __('Edit Comment') . ""; - echo " | comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), wp_specialchars( $comment->comment_author, 1 )) . "' );\">" . __('Delete Comment') . " — "; + echo " | comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), wp_specialchars( $comment->comment_author, 1 )) . "' );\">" . __('Delete Comment') . " "; + echo " | comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by "%s".\\n"Cancel" to stop, "OK" to mark as spam."), wp_specialchars( $comment->comment_author, 1 )) . "' );\">" . __('Mark Comment as Spam') . " "; } // end if any comments to show // Get post title if ( current_user_can('edit_post', $comment->comment_post_ID) ) { $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"); $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; - ?> + ?> | |
@@ -154,7 +163,8 @@ if ('view' == $mode) { } // end foreach ?> -')" />
+')" /> + ')" />
comment_post_ID) ) + die('-1'); + + if ( wp_set_comment_status($comment->comment_ID, 'spam') ) { + die('1'); + } else { + die('0'); + } + break; case 'delete-link-category' : $id = (int) $_POST['id']; if ( 1 == $id ) diff --git a/wp-admin/post.php b/wp-admin/post.php index 4160ce57c7..11d46c23c2 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -184,7 +184,10 @@ case 'confirmdeletecomment': die( __('You are not allowed to delete comments on this post.') ); echo "" . __('Caution: You are about to delete the following comment:') . "
\n"; + if ( 'spam' == $_GET['delete_type'] ) + echo "" . __('Caution: You are about to mark the following comment as spam:') . "
\n"; + else + echo "" . __('Caution: You are about to delete the following comment:') . "
\n"; echo "" . __('Author:') . " | $comment->comment_author |
" . __('E-mail:') . " | $comment->comment_author_email |