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

Is it possible to get the primary group ID?

Discussion in 'XenForo Development Discussions' started by Daniel 'RTRD', Oct 30, 2012.

  1. Daniel 'RTRD'

    Daniel 'RTRD' Well-Known Member

    Is it possible to get the primary group ID?

    I am currently using this code:
    Code:
    <xen:if is="{xen:helper ismemberof, $user, 3}">
    Content here
    </xen:if>
    I have already read this thread but I can't seem to find a solution. Anyone got a solution?
     
  2. James

    James Well-Known Member

    If you want to get the primary group ID of a user:
    $visitor.user_group_id (current logged in user)
    $user.user_group_id (user whose details you're looking at)
     
    Daniel 'RTRD', Marcus and Chris D like this.
  3. Daniel 'RTRD'

    Daniel 'RTRD' Well-Known Member

    I will test this! :)
     
  4. Daniel 'RTRD'

    Daniel 'RTRD' Well-Known Member

    I cant make this work:
    Code:
    <xen:if is="{$user.user_group_id} == {xen:property SomePropertyNameHere}">
     
    CONTENT HERE
     
    </xen:if>
     
  5. James

    James Well-Known Member

    What are you trying to do? There might be a better way.
     
  6. Daniel 'RTRD'

    Daniel 'RTRD' Well-Known Member

    I need to get the primary group for the user to show a ribbon. When I use "ismemberof" it shows all of the groups.
     
  7. James

    James Well-Known Member

    Technically if you use the permissions as XenForo wants, ie inheritance, then everyone's primary usergroup should be Registered.

    Nevertheless, ensure the user var is available in your template and double check the xen:property syntax, I would myself but I'm mobile right now.
     
  8. Daniel 'RTRD'

    Daniel 'RTRD' Well-Known Member

    I sent you a PM.
     

Share This Page