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

jflory7

Active member
Hello,

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:

HTML:
<xen:if is="{$user.user_group_id} == 5">
    <span class="rank rankModerator">Moderator</span>
</xen:if>

Then I add the following snippets to my EXTRAS file.
CSS:
.rank {
  display:inline-block;
  width:108px;
  margin:2px 0 5px;
  padding:2px 0 3px;
  border:1px solid @primaryLight;
  border-radius:5px;
  background:@primaryLighterStill url('@imagePath/xenforo/gradients/tab-unselected-25px-light.png') repeat-x top;
  text-align:center;
  font:11px verdana,sans-serif;
  text-decoration:none;
  color:#F5FFFA;
  outline:0;
}

CSS:
.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. :)
 
This?
Code:
<xen:if is="{xen:helper ismemberof, $user, x}">

https://xenforo.com/community/resources/conditional-statements.1604/
I get the following error when trying that. Not sure how to troubleshoot this further. I did check that guide out when I was trying to figure it out, but I had the same issue before.
330e1b610b10fd001a07ea50098ab6d8.png


9a6937ced04168ee6e984d0c213fc3fc.png
 
I get the following error when trying that. Not sure how to troubleshoot this further. I did check that guide out when I was trying to figure it out, but I had the same issue before.
330e1b610b10fd001a07ea50098ab6d8.png


9a6937ced04168ee6e984d0c213fc3fc.png
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.
 
Your missing a '}' on the usergroup 29 conditional.
:oops: Guess I was having an off day. Totally didn't see that, and of course, that resolved my problem…
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.
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. :)
 
Top Bottom