Override Comment Blacklist
-
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 (‘https://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);
- The topic ‘Override Comment Blacklist’ is closed to new replies.