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

XF 1.1 Various postbit colors by usergroups

Discussion in 'XenForo Questions and Support' started by Krafty, Oct 27, 2011.

  1. Krafty

    Krafty Member

    Is there a way so perhaps the postbit avatar border can be different colors according to usergroups?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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:

    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:

    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:

    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
     
    Kim, Bram, Dannyh and 1 other person like this.
  3. Krafty

    Krafty Member

    Alright, thanks.
     
  4. eransss

    eransss Active Member

    <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
     

    Attached Files:

  5. ArnyVee

    ArnyVee Well-Known Member

  6. eransss

    eransss Active Member

    Is it effective for the chat box ?
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    When you edit the template don't change the title. Try re-entering your Admin CP and editing the template again.
     

Share This Page