XF 1.1 Various postbit colors by usergroups

Jake Bunce

XenForo moderator
Staff member
#2
I don't like this solution because you have to manually specify the group ids in both templates. But it's the best solution I can think of at the moment.

Edit this template:

Admin CP -> Appearance -> Templates -> message

Add the red code:

Rich (BB code):
<xen:require css="message.css" />
<xen:require css="bb_code.css" />

<li id="{$messageId}" class="message {xen:if '{xen:helper ismemberof, $message, 5}', 'group5'} {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">

	<xen:include template="message_user_info">
		<xen:map from="$message" to="$user" />
	</xen:include>
You can cover other groups by adding more instances of that code. For example:

Rich (BB code):
<xen:require css="message.css" />
<xen:require css="bb_code.css" />

<li id="{$messageId}" class="message {xen:if '{xen:helper ismemberof, $message, 5}', 'group5'} {xen:if '{xen:helper ismemberof, $message, 6}', 'group6'} {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">

	<xen:include template="message_user_info">
		<xen:map from="$message" to="$user" />
	</xen:include>
Then edit this template:

Admin CP -> Appearance -> Templates -> EXTRA.css

Add this code to set the colors for the different groups:

Rich (BB code):
.message.group5 .messageUserBlock,
.message.group5 .avatarHolder
{
	background: blue;
}
.message.group5 .messageUserBlock .arrow span
{
	border-left-color: blue;
}



.message.group6 .messageUserBlock,
.message.group6 .avatarHolder
{
	background: red;
}
.message.group6 .messageUserBlock .arrow span
{
	border-left-color: red;
}
Use any color you want. This is the result:

Screen shot 2011-10-26 at 10.45.05 PM.png
 

eransss

Active member
#4
<xen:require css="message.css" />
<xen:require css="bb_code.css" />

<li id="{$messageId}" class="message {xen:if '{xen:helper ismemberof, $message, 5}', 'group5'} {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">

<xen:include template="message_user_info">
<xen:map from="$message" to="$user" />
</xen:include>


I get error
 

Attachments

Top