• Where is the code for the spam words comment moderation located?
    I have all comments moderated- but get sick of needing to delete all the notifications and moderated comments for the spam.
    I have been using code like this:
    $spam = (!is_int(strpos($author, ‘texas’)));
    if (!$spam)
    die( __($spam) );
    In my wp-comments-post.php file which rather than ‘moderating’ a comment when it matches a word- the comment never even gets made. Further more, I am pondering sending the matched words into an infinite redirect loop, or maybe some sort of per click ranking site.
    The code I have been using works, but it is obviously not very scalable. I would like to modify the spam words list so that if something in the comment matches- it dies rather than goes to the queue

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter clay

    (@clay)

    Adding this to wp-comments-post.php seemed to work:
    if ('' == trim( get_settings('moderation_keys') ) ) return true; // If moderation keys are empty
    $words = explode("\n", get_settings('moderation_keys') );
    foreach ($words as $word) {
    $word = trim($word);
    $pattern = "#$word#i";
    if ( preg_match($pattern, $author) ) die( __('Please Fuck off') );
    if ( preg_match($pattern, $email) ) die( __('Please Fuck off') );
    if ( preg_match($pattern, $url) ) die( __('Please Fuck off') );
    if ( preg_match($pattern, $comment) ) die( __('Please Fuck off') );
    if ( preg_match($pattern, $user_ip) ) die( __('Please Fuck off') ); }

    Thread Starter clay

    (@clay)

    This seems to be working very well- I rarely get a spam comment these days.

    If I do- I simply add it to the spamwords list and kill it before I get a million of them

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comment Moderation and Spam wordlist code?’ is closed to new replies.