• I do not know where to post hacks, so I post it here in the support forum.

    I am under constant “attack” from spammers trying to post a lot of comments in my wordpress-blogs. The clostest thing to getting rid of these was entering words into the setup to get them into the moderation queue instead of being posted directly.

    First I created a mysql cron-job to delete all comments with the field comment_approved in table wp_comments equal to 0. This deleted all the unwanted posts, but I still got >25 emails a day telling me that a comment expected approval.

    So I opened the file wp-comments-post.php and browsed through it and found the test that sent the notification email to the blog owner.

    I changed the following:

    if (!$approved) {
    wp_notify_moderator($comment_ID);
    }

    to:

    if (!$approved) {
    $wpdb->query(“DELETE FROM $tablecomments WHERE comment_ID =$comment_ID”);
    }

    And I got rid of the cron-job, notification mail and most importantly the unwanted comments. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Wouldn’t that simply remove delete all unapproved comments, w/o allowing legitimate users to post comments ?

    If so then what is the point in enabling comments at all ? just disable the comments for your posts and be done with it.

    Interesting idea, though. If it could delete comments awaiting approval that contained any of the words/elements in your Options/Discussions/Comment Moderation box, that might be interesting.

    Thread Starter raskall

    (@raskall)

    That is exactly what I have done. I allow all comments, but the ones containing words/elements from Options/Discussions/Comment Moderation box is now simply deleted during posting.

    But it requires comment moderation to be turned off. Now everyone can post comments without registering, but comments containing unwanted words is deleted instead of put in the moderation queue.

    It’s nothing new….. SpamKarma does that for me as well.

    Tg

    It’s not new, but it is a different approach that may suit some people better than using a plugin such as SpamKarma. raskall has essentially hacked wp-comments-post.php so as to treat the moderation list as a blacklist.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[1.2] Delete spam-comments instead of just queuing them!’ is closed to new replies.