The MU forums have moved to WordPress.org

Black List Specific E-mail address from making comments (2 posts)

  1. kailasa
    Member
    Posted 15 years ago #

    We have a blog that is open to comments from the general public. Sometimes we get a "nut case" who starts making comments. Can I black list his email address? Of course he can simply a different email address but at least I can discourage him from making comments. Ideally he will be allowed to comment, but they just never appear.

  2. dsader
    Member
    Posted 15 years ago #

    There is a Sitewide blacklist to ban registrations at SiteAdmin->Options but not for comments. Each blog can build their own blacklist at Settings->Discussion.

    Now that you get me thinking, I think I'd like a WPMU plugin for Sitewide comment blacklist with a textarea option at SiteAdmin->Options. Hmmm. Another day. Another plugin contest.

    In the meantime, the function wp_blacklist_check from wp-includes/comment.php has a plugin hook so a quick mu-plugin tackles an emergency but isn't very elegant:

    <?php
    function my_site_blacklist($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent) {
    			if ($comment_author_email == 'cruella@deville.com') {
    	                wp_die('No puppies here!'); // comment vanishes
                            }
    }
    add_action('wp_blacklist_check', 'my_site_blacklist', 10, 6);
    ?>

About this Topic