Looking for the php conditionals...

by AndresXZ09 - 20-02-2015, 11:44 PM
Closed Account
Posts:
1,382
Joined:
Jan 2015
Likes:
125
Credits:
1,388
Reputation:
30
3 Years of Service
#1
OP
Posted: 20-02-2015, 11:44 PM
Hello

I'd like to know which conditionals works on the custom pages (example, groups.php) and what is the group id conditional.

I tried with

Code:
<if $post['gid'] == 4 then>Stuff<else>More stuff</if>

But sadly doesn't work.

Thank you for your time.
Closed Account
Posts:
2,764
Joined:
Jan 2015
Likes:
142
Credits:
1,946
Reputation:
26
3 Years of Service
#2
Posted: 20-02-2015, 11:48 PM
Closed Account
Posts:
1,382
Joined:
Jan 2015
Likes:
125
Credits:
1,388
Reputation:
30
3 Years of Service
#3
OP
Posted: 21-02-2015, 12:03 AM (This post was last modified: 21-02-2015, 12:26 AM by AndresXZ09. Edit Reason: Updated )
(20-02-2015, 11:48 PM)Hug Wrote: http://bit.ly/19M6uvD

Thanks for your help but I already have the plugin :fp: I need the code for the custom pages and groups, I thought it was gid but I was wrong and about the custom pages I think it should be $global but I'm not sure.

EDIT: I found the code, it's

Code:
<if $GLOBALS['mybb']->user['usergroup'] == 4 then>Upgrade<else>You're already upgraded</if>

But I would like to know how to add multiple user groups, I tried with

Code:
<if $GLOBALS['mybb']->user['usergroup'], array(4,16) then>Upgrade<else>You're already upgraded</if>

But it gives me an error.

EDIT

Code:
<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,16)) then>Upgrade<else>You're already upgraded</if>

That's the code, thanks.

You can close
The Mandingo Man
Staff
Posts:
931
Joined:
Jan 2015
Likes:
145
Credits:
1,867
Reputation:
171
3 Years of Service
#4
Posted: 21-02-2015, 12:27 AM (This post was last modified: 21-02-2015, 12:29 AM by Pulseeey.)
<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,16) then>Upgrade<else>You're already upgraded</if>
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)