F
Floris
Guest
This is one of the best template modifications I've seen so far that respects the xenforo-way of doing things. Simple, effective, and looks great.
I'm blind. Link me?That goes hand in hand neatly with the css forum icons I wanted, which Jake did.
If everything is CSS then it will mean faster loading times and no need to create multiple image sets for each style.
Step 1:
Open template: message_user_info
FIND:
Code:<xen:if hascontent="true"> <div class="extraUserInfo">
ABOVE ADD:
(To show the appropriate rank for other usergroups you'll need a new conditional for every added rank. Replace 5 with the appropriate usergroup ID.)Code:<!-- START USER RANK --> <xen:if is="{$user.is_admin}"> <span class="userrank">Administrator</span> </xen:if> <xen:if is="{$user.is_moderator} AND !{$user.is_admin}"> <span class="userrank">Moderator</span> </xen:if> <xen:if is="{$user.user_group_id} == 5"> <span class="userrank">Your_custom_usergroup_name</span> </xen:if> <!-- END USER RANK -->
<xen:if is="{$user.user_group_id} == 5">
<xen:if is="{$user.user_group_id} == 5 AND !{$user.is_admin} AND !{$user.is_moderator}">
Yes depending on wheter you want to show one or multiple ranks (I think most would prefer just one). Thanks for your addition.
No prob. I've added it to the OP.Yes, sorry for my lack of explication
To find the ID number of a user group, click on it in the ACP and it will be displayed in the URL.How would you use this to give members their title as well. I don't know what usergroup they are. XD
.userrank
{
display: block;
width: 108px;
margin: -2px 0 5px 6px;
padding: 2px 0 3px 0;
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: @primaryMedium;
text-shadow: 1px 1px 0 #fff;
outline: 0;
}
<xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
<xen:if hascontent="true"><em class="userrank" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
<xen:contentcheck>
<xen:foreach loop="$onlineUsers.records" value="$user">
<xen:if is="{$user.is_moderator} OR {$user.is_admin}">
<li>
<xen:avatar user="$user" size="s" img="true" />
<xen:username user="$user" rich="true" />
<div class="userTitle">{xen:helper userTitle, $user}</div>
</li>
</xen:if>
</xen:foreach>
</xen:contentcheck>
<xen:contentcheck>
<xen:foreach loop="$onlineUsers.records" value="$user">
<xen:if is="{$user.is_moderator} OR {$user.is_admin}">
<li>
<xen:avatar user="$user" size="s" img="true" />
<xen:username user="$user" rich="true" />
<div class="userrank">{xen:helper userTitle, $user}</div>
</li>
</xen:if>
</xen:foreach>
</xen:contentcheck>
.userrank
{
display: block;
width: 100px;
margin: 2px 0 10px 45px;
padding: 2px 0 3px 0;
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: @primaryMedium;
text-shadow: 1px 1px 0 #fff;
box-shadow: 0px 2px 5px rgba(0,0,0, 0.2);
outline: 0;
}
Two ways of doing it:How would one go about using it on a per user basis instead? Eg...
If user ID == 42...
<span class="userrank">Rank-for-member-42</span>
What'd the syntax be?
Not a PHP dev, so yeah...cheers![]()
{xen:if '{$user.user_id} == 42', '<span class="userrank">Rank-for-member-42</span>'}
<xen:if is="$user.user_id == 42"><span class="userrank">Rank-for-member-42</span></xen:if>
We use essential cookies to make this site work, and optional cookies to enhance your experience.