diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 32ec092ae..1a5acdd47 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) . "

"; + echo '

'; + if ( !empty( $_POST['spam_button'] ) ) + printf(__('%s comments marked as spam.'), $i); + else + printf(__('%s comments deleted.'), $i); + echo '

'; endif; if (isset($_GET['s'])) { @@ -96,13 +104,14 @@ if ('view' == $mode) {

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 4160ce57c..11d46c23c 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 "
\n"; - 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 "\n"; echo "\n"; echo "\n"; @@ -195,6 +198,8 @@ case 'confirmdeletecomment': echo "\n"; echo "\n"; + if ( 'spam' == $_GET['delete_type'] ) + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -226,8 +231,10 @@ case 'deletecomment': if ( !current_user_can('edit_post', $comment->comment_post_ID) ) die( __('You are not allowed to edit comments on this post.') ); - wp_set_comment_status($comment->comment_ID, "delete"); - do_action('delete_comment', $comment->comment_ID); + if ( 'spam' == $_GET['delete_type'] ) + wp_set_comment_status($comment->comment_ID, 'spam'); + else + wp_delete_comment($comment->comment_ID); if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { header('Location: ' . $_SERVER['HTTP_REFERER']); diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index fcacd2f05..d8cad5267 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -332,6 +332,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') { } $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); @@ -389,6 +390,7 @@ function wp_notify_moderator($comment_id) { $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
" . __('Author:') . "$comment->comment_author
" . __('E-mail:') . "$comment->comment_author_email