[wp-hackers] Moderation faulty in WP12?

Mark Jaquith mark.wordpress at txfx.net
Wed Oct 13 21:09:11 UTC 2004


Michael Heilemann wrote:

> I've turned on moderation of comments on my blog for the time being, 
> but it seems that a few comments manage to slip through without me 
> moderating them?...
>
> It seems to happen mostly to small comments. Anyone seen this before?

Here's the function that determines $approved, and whether or not the 
comment goes live or to moderation:

    function check_comment($author, $email, $url, $comment, $user_ip) {
        *if (1 == get_settings('comment_moderation')) return false; //
    If moderation is set to manual*

        if ( (count(explode('http:', $comment)) - 1) >=
    get_settings('comment_max_links') )
            return false; // Check # of external links

        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) ) return false;
            if ( preg_match($pattern, $email) ) return false;
            if ( preg_match($pattern, $url) ) return false;
            if ( preg_match($pattern, $comment) ) return false;
            if ( preg_match($pattern, $user_ip) ) return false;
        }

        return true;
    }

The bolded line is the one that comes into play.  Personally, I can't 
see any reason why the length of a comment would have any effect on it's 
$approved status.  The first check in check_comment() is the moderation 
setting.  It immediately returns false, so nothing else is even evaluated.

That's a strange problem.  You don't have any comment moderation hacks 
of plugins installed, do you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/hackers_wordpress.org/attachments/20041013/f295c2ee/attachment-0001.htm


More information about the hackers mailing list