• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to find usergroup id's ??

ExpertPixels.com

Well-known member
#1
Last question for today... SORRY lol... got stuck right into XF tonight and well i started playing with conditionals and now i can stop :(

So i am wondering how do i find a / the usergroup id number of usergroups ?

basically i am trying to display a section in the sidebar to only certain groups (groups that have upgraded accounts) i believe these would be called "Secondary User Groups" ideally i would like admins, mods and upgraded members to be able to see a extra block in the sidebar.. so far i have it working but am struggling with usergroup id's :S

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 2}">
<div class="custom-div">Want to Display this to certain usergroups</div></xen:if>
Again, Thanks in advanced for any help on this topic, ive searched the forums high and low trying to work out how to find a usergroup id number and even the xf backend (i thought hovering over a usergroup would at least show a "?=4" or some indication of the id number.

Cheers for any help here.

Regards, Darren
 

ExpertPixels.com

Well-known member
#3
TY :( my bad time for bed now lmao.. wow i am lame sorry for your trouble..

PS.. how to add multiple usergroups ??

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 2,5}">
<div class="custom-div">Want to Display this to certain usergroups</div></xen:if>
tried the above with comma's but it gives me an error.

Thanks again
 

Brogan

XenForo moderator
Staff member
#4
Like this:

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 3} OR {xen:helper ismemberof, $visitor, 4} OR {xen:helper ismemberof, $visitor, 5}">
<xen:include template="your_template" />
</xen:if>

I actually do it the other way and exclude groups like so:
Code:
<xen:if is="!{xen:helper ismemberof, $visitor, 3} AND !{xen:helper ismemberof, $visitor, 4} AND !{xen:helper ismemberof, $visitor, 5}">
<xen:include template="your_template" />
</xen:if>
That will show it everyone except those in groups 3, 4 and 5.