[wp-hackers] Moderation faulty in WP12?

Michael Heilemann michael at binarybonsai.com
Wed Oct 13 21:17:20 UTC 2004


Mark, it was indeed a plugin that was messing up things. A plugin which=20=

turns on moderation on entries older than X days. Why it acted the way=20=

it did, I have no idea... :=F5

- Mike

On 13/10-2004, at 23.09, Mark Jaquith wrote:

>  Michael Heilemann wrote:
>  I've turned on moderation of comments on my blog for the time being,=20=

> but it seems that a few comments manage to slip through without me=20
> 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=20=

> comment goes live or to moderation:
>
>
> function check_comment($author, $email, $url, $comment, $user_ip) {
>  =CA=CA=CA if (1 =3D=3D get_settings('comment_moderation')) return =
false; // If=20
> moderation is set to manual
>
>  =CA=CA=CA if ( (count(explode('http:', $comment)) - 1) >=3D=20
> get_settings('comment_max_links') )
>  =CA=CA=CA =CA=CA=CA return false; // Check # of external links
>
>  =CA=CA=CA if ('' =3D=3D trim( get_settings('moderation_keys') ) ) =
return true;=20
> // If moderation keys are empty
>  =CA=CA=CA $words =3D explode("\n", get_settings('moderation_keys') );
>  =CA=CA=CA foreach ($words as $word) {
>  =CA=CA=CA $word =3D trim($word);
>  =CA=CA=CA $pattern =3D "#$word#i";
>  =CA=CA=CA =CA=CA=CA if ( preg_match($pattern, $author) ) return =
false;
>  =CA=CA=CA =CA=CA=CA if ( preg_match($pattern, $email) ) return false;
>  =CA=CA=CA =CA=CA=CA if ( preg_match($pattern, $url) ) return false;
>  =CA=CA=CA =CA=CA=CA if ( preg_match($pattern, $comment) ) return =
false;
>  =CA=CA=CA =CA=CA=CA if ( preg_match($pattern, $user_ip) ) return =
false;
>  =CA=CA=CA }
>
>  =CA=CA=CA return true;
>  }
>
>  The bolded line is the one that comes into play.=CA Personally, I =
can't=20
> see any reason why the length of a comment would have any effect on=20
> it's $approved status.=CA The first check in check_comment() is the=20
> moderation setting.=CA It immediately returns false, so nothing else =
is=20
> even evaluated.
>
>  That's a strange problem.=CA You don't have any comment moderation=20
> hacks of plugins installed, do you?
>  _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org




More information about the hackers mailing list