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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

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

Post 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...
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
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 »

Thanks
I will give it a try :)
Locked

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