MyBB Community Forums
If Variable? - Printable Version

+- MyBB Community Forums (
+-- Forum: 1.8 Support (
+--- Forum: General Support (
+--- Thread: If Variable? (/thread-174313.html)

If Variable? - SolarCrane - 2015-08-11

Hey everyone. Smile

I'm adding a "tab" in my profiles just for moderation options, and I was wondering if there was a variable I could put before the <div> that would check if the user is currently a moderator so that the tab would not show to anyone unless they are in a certain usergroup. Thanks. Smile

RE: If Variable? - zamight - 2015-08-11

If you want to add another tab to the Moderator Options in the profiles you can edit "member_profile_modoptions" in the Members template of Templates & Styles.

It is the mod menu that is already in the profiles.

RE: If Variable? - SolarCrane - 2015-08-11

I meant putting the moderation options into a tab, not adding another tab. (It doesn't even have tabs to begin with?)

<div class="panel panel-3">

The above is my code which is the third tab of the profile, which looks like so:

[Image: Gkuxaeh.png?1]

Now I want to add another tab, which I can do. However what I need help with is trying to figure out how I can restrict that tab to a certain member group only, I figured ya'll have a {if} statement of some kind.

RE: If Variable? - zamight - 2015-08-11

This should tell you everything about template conditioning.

RE: If Variable? - mmadhankumar - 2015-08-11

Use this rather than the one mentioned above:

its the simple/lite version of "PHP in Templates" which is linked in above post...

then you can use a conditional like this....

<if $mybb->user['usergroup'] == 4 then>
//content to show only for admin

<if in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6)) then>
//content to show for all default mod/admin groups

RE: If Variable? - SolarCrane - 2015-08-11

You are awesome mmadhankumar!! Thank you! Smile