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

XF 1.4 Checking if a user is a member of a secondary group within XenForo syntax

Discussion in 'Styling and Customization Questions' started by jflory7, Apr 13, 2015.

  1. jflory7

    jflory7 Active Member


    First off, I was trying to find the appropriate forum to post this in, but I was having problems choosing between Styling and Customization Questions and XenForo Development, so if this in the wrong forum, please let me know.

    I have recently been trying to modify some CSS in my forum to add cool user group banners for some groups. I'm doing this by doing a combination of template edits to my message_user_info template and my EXTRAS.css template. For example, one rank I have is as follows:

    <xen:if is="{$user.user_group_id} == 5">
        <span class="rank rankModerator">Moderator</span>
    Then I add the following snippets to my EXTRAS file.
    .rank {
      margin:2px 0 5px;
      padding:2px 0 3px;
      border:1px solid @primaryLight;
      background:@primaryLighterStill url('@imagePath/xenforo/gradients/tab-unselected-25px-light.png') repeat-x top;
      font:11px verdana,sans-serif;
    .rankModerator {
      border: 1px solid #0082BA;
      background: #0082BA url('@imagePath/xenforo/gradients/tab-unselected-25px-light.png') repeat-x top;

    Now, the dilemma comes when I'm trying to give a custom banner to a user who is only in the target group as a secondary member. I've been playing with all sorts of ways to check for membership in the secondary group ID, but nothing I have tried so far works, and I'm not familiar with much webdev sort of work in the first place, so I am unsure where to look up more information or what to modify to test another way.

    Any advice would be appreciated - thank you! And if something wasn't clear, please address it so I can clarify it. :)
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. jflory7

    jflory7 Active Member

  4. Steve F

    Steve F Well-Known Member

    Your missing a '}' on the usergroup 29 conditional.

    As for what your wanting, it seems as though you may have some users set as having a primary group other than the registered group? Any user that has a group added should be secondary to the registered group.
  5. jflory7

    jflory7 Active Member

    :oops: Guess I was having an off day. Totally didn't see that, and of course, that resolved my problem…
    I only have my server staff set as primary groups (e.g. about seven people). Even for this small number of people, you would still recommend only using the registered group as the primary? If so, why? I'm just curious to know what the best practices are so I can learn. :)
  6. Brogan

    Brogan XenForo Moderator Staff Member

Share This Page