1. 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 ??

Discussion in 'XenForo Questions and Support' started by ExpertPixels.com, Mar 15, 2011.

  1. ExpertPixels.com

    ExpertPixels.com Well-Known Member

    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
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Hover over the usergroup in the ACP or click on it and it will show in the address bar.

    For example: ...admin.php?user-groups/administrative.3/edit

    The group ID is therefore 3.

    The default IDs are listed here: http://xenforo.com/help/user-groups/
     
  3. ExpertPixels.com

    ExpertPixels.com Well-Known Member

    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
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    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.
     

Share This Page