PDA

View Full Version : A simple alteration of an if statement


JPnyc
01-25-2007, 08:18 PM
My problem is that in searching the forum I wasn't able to find the variable name for a thread/post author's post count. I want to append an if statement to also test for author's post count. Something like:

AND ($bbuserinfo['posts'] < 10)

How far off am I? Thanks

peterska2
01-25-2007, 08:49 PM
<if condition="$post[posts] < 10">is what you want

JPnyc
01-25-2007, 08:54 PM
Thank you Kerry-Anne, but I should've been more specific. This is not coded within a template but a plugin. Would the variable be the same? Or must it be prefaced by $vbulletin-> ?

sebbe
01-25-2007, 11:45 PM
if ($post['posts'] < 10)
{
//code
}

Needs to go inside a postbit hook.

JPnyc
01-26-2007, 11:03 AM
Thanks; I still can't get it to test for postcount. Here's the entire 1st if statement;

if (str_replace(explode(',', $this->registry->options['automodkeywords']), '', strtolower($this->fetch_field('pagetext','post'))) != strtolower($this->fetch_field('pagetext','post')) AND !can_moderate() AND ($post['posts']< 10))

I also tried without the extra parens

Thanks for your assistance.

Paul M
01-26-2007, 12:06 PM
What hook are you using ?

JPnyc
01-26-2007, 01:13 PM
It's actually in a product, it's a mod of the spam filter I found on this site. The filter works fine, I just wanted to append the test to exclude users with more than 10 posts. If need be I suppose I could create another default reg. user group and a promotion for 10 posts, then test for usergroup, but with 30 forums that's a whole lot of work.

edit: I went into the xml and found the hook, it's threadfpdata_presave.

Is it possible that variable isn't populated on that hook?

JPnyc
01-27-2007, 02:15 PM
I need to get this sorted. The spam filter is blocking too many legit posts and the keywords list is as trimmed down as can be. Anyone know how I can add a test for post count to this if statement? Thanks

JPnyc
01-28-2007, 03:32 PM
Never mind, found another filter here with that functionality included.