• This is the function, with various parts changed for privacy (a private spam blocking list or SBL). I already use it block connections from undesirables before WordPress loads, but some of them still manage to get through (proxy or whatever) and the blocked IPs or domains still get posted. I want to hook into the comments blacklist and stop them there if they make it that far. Here’s what I have and the question is how do I populate the author variables? Am I using the right filter?

    ***

    function sbl ($approved) {
    $a = file_get_contents (‘http://my.domain.com/check.php?ip=’ . $comment_author_IP . ‘&ref=’ . $_SERVER[‘HTTP_REFERER’] . ‘&uri=’ . $comment_author_url); $a = trim($a);
    if ($a == ‘ip’ || $a == ‘uri’) {
    $error_message_detailed = ‘Your comment has been blocked based on the blog owner\’s blacklist settings.

    If you feel this is in error, please contact the blog owner by some other method.

    ‘.”\n”;
    wp_die( __($error_message_detailed) );
    return false;
    }
    }
    add_filter(‘pre_comment_approved’, ‘sbl’, 1);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Bad Behavior does what you’re looking for. You may want to either dissect the code or use it instead:

    http://wordpress.org/extend/plugins/bad-behavior/

    Thread Starter rtcunningham

    (@rtcunningham)

    Bad behavior behaves badly. How’s that for a twist? It blocks people it shouldn’t. I know, because I tested it for a day.

    I hate dissecting plugins. I usually find the answer isn’t there.

    Thread Starter rtcunningham

    (@rtcunningham)

    I recently wrote a custom script to drop the IP addresses and ranges via an include to wp-config.php. I would much rather have a real blacklist for comments vs. one that marks them as spam. I’ve search through WordPress support posts going back as far as 2005 and this is really something that people want.

    I just wish I knew how – I tried to make a plugin, but it failed to work as intended.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Override Comment Blacklist’ is closed to new replies.