Log in

View Full Version : Need a quick snippet of code for user permissions


Club3G
12-22-2005, 05:15 PM
I'm looking to add a navbar link for only certain usergroups, basically only have the text show up if the user is in group 1, 2 or 3. Should be pretty straight forward, but I don't see any bits of code I can swipe that look familiar enough to work. :D

Any insight would be awesome - thanks!

Update #1:

I found this while searching around, but it's not working.


<if condition="!is_member_of($bbuserinfo, 6)">
Custom Text
</if>


Usergroup 6 is Admin (me) but I'm still not seeing the text, and even then I'm not sure how to set it for more than one usergroup. What I have on my site is an image uploader script that's separate from vBulletin altogether - I'm just trying to create a navbar link that only shows up for myself and my mods.

Got it to work for single usergroups using this:
<if condition="$bbuserinfo['usergroupid'] == '6'">
Text, etc
</if>

Just not sure on how to format the "or usergroup == '5'" conditionals.

Adrian Schneider
12-22-2005, 05:50 PM
<if condition="is_member_of($bbuserinfo, X) OR is_member_of($bbuserinfo, Y) OR is_member_of($bbuserinfo, Z)">Show to groups X Y and Z</if>

or for primary groups only

<if condition="in_array($bbuserinfo['usergroupid'], array(X, Y, Z))">show to groups Z Y and Z</if>

Club3G
12-22-2005, 05:55 PM
That did it - Thank you very much!