SOLVED: Help on php condition: age of last post

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

SOLVED: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 8:04 am

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 ???)
Last edited by tanrek on Fri Mar 12, 2010 12:04 pm, edited 1 time in total.

User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

Re: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 8:18 am

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:

Oleg
Former Team Member
Posts: 1221
Joined: Sat Jan 30, 2010 4:42 pm
Location: NYC
Contact:

Re: Help on php condition: age of last post

Post by Oleg » Fri Mar 12, 2010 8:21 am

Try something like this.

Code: Select all

$user->data['user_lastpost_time'] >= time() - 100*86400
Participate in phpBB development: Get involved | Issue tracker | Report a bug | Development board | [url=irc://chat.freenode.net/phpbb-dev]Development IRC chat[/url]
My stuff: mindlinkgame.com

User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

Re: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 8:49 am

Thanx but: unexpected T_VARIABLE

Oleg
Former Team Member
Posts: 1221
Joined: Sat Jan 30, 2010 4:42 pm
Location: NYC
Contact:

Re: Help on php condition: age of last post

Post by Oleg » Fri Mar 12, 2010 9:04 am

What is the complete statement in which you get that error?
Participate in phpBB development: Get involved | Issue tracker | Report a bug | Development board | [url=irc://chat.freenode.net/phpbb-dev]Development IRC chat[/url]
My stuff: mindlinkgame.com

User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

Re: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 9:09 am

Code: Select all

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

User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

Re: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 9:25 am

The statement

Code: Select all

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

Oleg
Former Team Member
Posts: 1221
Joined: Sat Jan 30, 2010 4:42 pm
Location: NYC
Contact:

Re: Help on php condition: age of last post

Post by Oleg » Fri Mar 12, 2010 9:43 am

You most likely have a syntax error elsewhere in your script.
Participate in phpBB development: Get involved | Issue tracker | Report a bug | Development board | [url=irc://chat.freenode.net/phpbb-dev]Development IRC chat[/url]
My stuff: mindlinkgame.com

User avatar
tanrek
Registered User
Posts: 219
Joined: Mon Sep 27, 2004 1:46 pm
Location: Germany, Offenbach
Contact:

Re: Help on php condition: age of last post

Post by tanrek » Fri Mar 12, 2010 12:03 pm

I don't find it but I found another solution. Thanx anyway. :D

User avatar
katib
Registered User
Posts: 562
Joined: Thu Jun 26, 2008 12:27 pm

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

Post by katib » Sun Mar 21, 2010 2:29 pm

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

User avatar
3Di
Former Team Member
Posts: 14477
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

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

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

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...
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️

User avatar
katib
Registered User
Posts: 562
Joined: Thu Jun 26, 2008 12:27 pm

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

Post by katib » Tue Mar 23, 2010 1:09 pm

Thanks
I will give it a try :)

Locked

Return to “[3.0.x] MOD Writers Discussion”