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

Secondary usergroup in "message_user_info"

Discussion in 'Styling and Customization Questions' started by Jack Burton III, Feb 27, 2012.

  1. In my message_user_info template I've inserted {$user.user_group_id} to show ID of primary usergroup. But now I want to show the secondary usergroup with the highest display styling priority: how could I do that?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. I explain my needs.

    My usergroups are inspired by military hierarchy (Soldier, Sergeant, Lieutenant, Captain, etc etc) and I use the promotion system to permit them to climb the hierarchy.

    In my old vB4 forum, I put this in "postbit":

    <img src="/styles/usergroup/{vb:raw post.usergroupid}.png" />

    to show an image that represent the grade of the user, and it changes every time system promote the primary usergroup.

    In XF this is not possible because the promotion system doesn't change the primary usergroup, but only the secondary group, and this code in “message_user_info”:

    <img src="/styles/usergroup/{$user.user_group_id}.png" />

    show an image that represent the primary usergroup: is there another way to view an image for secondary usergroup with highest priority?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can use a condition structure like this where you check groups in order of priority:

    Code:
    <xen:if is="{xen:helper ismemberof, $user, 4}">
    	HIGHEST IMAGE
    <xen:elseif is="{xen:helper ismemberof, $user, 5}" />
    	SECOND HIGHEST
    <xen:elseif is="{xen:helper ismemberof, $user, 6}" />
    	THIRD HIGHEST
    <xen:else />
    	LOWEST OR DEFAULT IF THEY AREN'T IN ANY OF THE GROUPS
    </xen:if>
    
     
    Jack Burton III likes this.
  5. Works fine, thank you!
     

Share This Page