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

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

Discussion in 'Styling and Customization Questions' started by younes, Aug 27, 2015.

  1. younes

    younes Active Member

    Hello guys
    I know how to do this for staff members

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

    Brogan XenForo Moderator Staff Member

    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.
    younes likes this.
  3. younes

    younes Active Member

    Thank you Brogan, can you give me an example please?
  4. Ynd21

    Ynd21 Member


    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

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

    Then in your Extra.css you'd add

    .message.donator {
    background-color: colorcodehere;
    This is my entire line
    <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
    younes likes this.

Share This Page