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

If usergroup=x display y in sidebar

Discussion in 'XenForo Questions and Support' started by David Gardiner, Mar 5, 2011.

  1. How easy is it to have a snippet of code in the sidebar that displays a message to people in a certain usergroup, possibly a

    "upgrade your membership to ....." if usergroup = regsitered normal, sort of thing
     
  2. borbole

    borbole Well-Known Member

    Try something like this:

    Code:
    <xen:if is="{$visitor.user_group_id} == x">
    <!-- Your message here -->
    </xen:if>
    And replace x with the usergroup that you want to show your message.
     
    David Gardiner likes this.
  3. Floris

    Floris Guest

    ^ that only works if the user is in the primary usergroup.
    If their account upgrade sets them to secondary (which it will) the msg will still show

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 5}">
    The user browsing is in either primary/secondary usergroup with id 5.
    </xen:if>
     
    David Gardiner and borbole like this.
  4. borbole

    borbole Well-Known Member

    I assumed that the OP wanted to show the message to the primary usergroup. But now he has both options :)
     
    Floris likes this.
  5. Thanks, perfect :)
     
    borbole likes this.
  6. Floris

    Floris Guest

    Figured that, :) But to add on to the info pile, I thought since he mentioned account upgrades I'd share the alternative.
     
    borbole likes this.
  7. borbole

    borbole Well-Known Member

    The more alternatives and options are suggested, the better :)
     
    Floris likes this.

Share This Page