The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Override Comment Blacklist (4 posts)

  1. rtcunningham
    Posted 6 years ago #

    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.

    wp_die( __($error_message_detailed) );
    return false;
    add_filter('pre_comment_approved', 'sbl', 1);

  2. James Huff
    Support Team Rep.
    Posted 6 years ago #

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


  3. rtcunningham
    Posted 6 years ago #

    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.

  4. rtcunningham
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic