MyBB Community Forums

Full Version: <if then> Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all. I am using the following code below to hide content I want from guests.

<if $mybb->usergroup['gid'] == 2 || $mybb->usergroup['gid'] == 3 || $mybb->usergroup['gid'] == 6 || $mybb->usergroup['gid'] == 4 || $mybb->usergroup['gid'] == 12 then>
</if>

I know there HAS to be a smaller code because I used to use it but then I lost it. What it did, was displayed to every group except 1 (guests).

THanks!
Try this. What this'll do is check if the user has a uid.

<if $mybb->user['uid'] then> </if>
Replace above with this;
<if $mybb->user['usergroup'] != 1 then>SHOW_CONTENT_HERE_TO_ALL_GROUPS_EXCEPT_GUESTS
</if>
What what this be if I wanted to ONLY show content to guests?
Or:

if (in_array($mybb->user['usergroup'], array(1,2,5,7)))
{
    //Content Here
} 


Show content to guests:

<if $mybb->user['usergroup'] == 1 then>
    //Content
</if> 

Or

<if $GLOBALS['mybb']->user['usergroup'] == 1 then>
    //Content
</if>
Makes perfect sense! Thanks!