XF 1.5 how to change post bg color for Specific User-groups?

younes

Active member
#1
Hello guys
I know how to do this for staff members

Code:
.messageList .message.staff {
  background-color: #ffaa66;
}
How about other User-groups? is it possible? :rolleyes:
 

Brogan

XenForo moderator
Staff member
#2
There isn't a different class for each user group.
You may be able to achieve it with conditional statements and inline styling or custom classes.
 
#4
Thank you Brogan, can you give me an example please?
Heya,

In case anyone didn't know how to do this (I totally was lost for a bit!) you'd edit the message template and on line 4 inbetween the staff code and the ignored code and add something like this

Code:
{xen:if '{xen:helper ismemberof, $message, X}', 'donator'}
X being Usergroup ID

Then in your Extra.css you'd add

Code:
.message.donator {
background-color: colorcodehere;
}
This is my entire line
Code:
<li id="{$messageId}" class="message {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_staff}', 'staff'} {xen:if '{xen:helper ismemberof, $message, 7}', 'premium'} {xen:if '{xen:helper ismemberof, $message, 12}', 'helper'} {xen:if '{xen:helper ismemberof, $message, 11}', 'donator'} {xen:if '{xen:helper ismemberof, $message, 10}', 'PZ'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">
For my site I added an image to the top right so it looks like
 
Top