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

If a user is in a group, don't run this script?

Discussion in 'XenForo Development Discussions' started by Valkyr, Sep 17, 2011.

  1. Valkyr

    Valkyr Member

    So if I put in a template a script that I only want to run for every group except for one is there some <xen if> thing for that?

    <xen:if user not in group (group name/ID goes here)>
    JQuery Script goes here
    Also, is there some place that lists all the possible xen:tag things?
  2. ragtek

    ragtek Guest

  3. Floris

    Floris Guest

    Here's my extra-debug-info script that helps designers and developers find the variables they need; [Product] XenFans.com - Extra Debug

    Only for admins:
    <xen:if is="{$visitor.is_admin}">

    Only for mods:
    <xen:if is="{$visitor.is_moderator}">

    Only for registered members: (not guests)
    <xen:if is="{$visitor.user_id}">

    To make things "not", you can also 'compare against' and make it not with !
    <xen:if is="{$visitor.user_id} != 1"> (if the user browsing, is NOT user_id 1)

    Only if the member is in primary/secondary usergroup "5"
    <xen:if is="{xen:helper ismemberof, $visitor, 5}">

    To make things "not", you can prefix the conditional with ! (exclamation mark)
    <xen:if is="!{xen:helper ismemberof, $visitor, 5}">

    Resource: template conditionals discussion
    Valkyr likes this.
  4. ragtek

    ragtek Guest

    check the xenforo\templates directory;)
    Valkyr and Floris like this.
  5. Valkyr

    Valkyr Member

    Thank you ragtek and Floris! Worked it out thanks to your help.
  6. Floris

    Floris Guest

    No problem. We share what we know and learned (and hope we're not wrong haha)

Share This Page