MyBB Community Forums
If Variable? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: If Variable? (/thread-174313.html)



If Variable? - SolarCrane - 08-11-2015

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 - 08-11-2015

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 - 08-11-2015

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">
					<h2>Signature</h2>
					<p>{$signature}</p>
				</div>

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 - 08-11-2015

This should tell you everything about template conditioning.

http://mybbhacks.zingaburga.com/showthread.php?tid=260


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

Use this rather than the one mentioned above: http://mybbhacks.zingaburga.com/showthread.php?tid=464

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>


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



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

You are awesome mmadhankumar!! Thank you! Smile