Page 1 of 1

SOLVED: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 8:04 am
by tanrek
Could someone please help me to fomulate a php condition?

I want to exclude lurkers from some feature of my forum, that means a user should have written at least 10 posts and his youngest post should not be older than 100 days. I have no idea how to to formulate the second condition.

Code: Select all

IF ($user->data['user_posts'] >= 10 AND ???)

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 8:18 am
by tanrek
Normally this should be no problem for me but I got a terrible flu and my mind is greyed out completely. But don't worry - this post is virus-free :mrgreen:

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 8:21 am
by Oleg
Try something like this.

Code: Select all

$user->data['user_lastpost_time'] >= time() - 100*86400

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 8:49 am
by tanrek
Thanx but: unexpected T_VARIABLE

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 9:04 am
by Oleg
What is the complete statement in which you get that error?

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 9:09 am
by tanrek

Code: Select all

IF (($user->data['user_posts'] >= 10) AND ($user->data['user_lastpost_time'] >= time() - 100*86400))
The first condition works.

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 9:25 am
by tanrek
The statement

Code: Select all

if ($user->data['user_lastpost_time'] >= time()-100*86400)
produces: unexpected '('

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 9:43 am
by Oleg
You most likely have a syntax error elsewhere in your script.

Re: Help on php condition: age of last post

Posted: Fri Mar 12, 2010 12:03 pm
by tanrek
I don't find it but I found another solution. Thanx anyway. :D

Re: SOLVED: Help on php condition: age of last post

Posted: Sun Mar 21, 2010 2:29 pm
by katib
tanrek wrote:I don't find it but I found another solution. Thanx anyway.
Could you pease share your finding, because I am interested in applying such condition on my borad

Re: SOLVED: Help on php condition: age of last post

Posted: Mon Mar 22, 2010 10:26 pm
by 3Di

Code: Select all

if ( ($user->data['user_posts'] >= 10) || ($user->data['user_lastpost_time'] >= ( (time() / 86400) * 100) ) )
{
    your code here;
} 
something the like, on the fly...

Re: SOLVED: Help on php condition: age of last post

Posted: Tue Mar 23, 2010 1:09 pm
by katib
Thanks
I will give it a try :)