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

changing messauge_user_info

Discussion in 'Styling and Customization Questions' started by addaco, May 26, 2011.

  1. addaco

    addaco Member


    I want to change the background around the avatar and username for members of a certain usergroup. I found the code in the css which affects it, but I am unsure what if function or how to add code that makes it a different colour for certain members

    Many thanks

    EDIT: remembered I need to use conditional <xen:if is="{xen:helper ismemberof, $user, 3}"> but not sure to add that and how to change the css
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Like this:

    Admin CP -> Appearance -> Templates -> message_user_info

    Add this code:

    style="{xen:if {xen:helper ismemberof, $user, 3}, 'background: black;'}"
    To both locations as shown below:

    <div class="messageUserBlock">
    	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    		<div class="avatarHolder" style="{xen:if {xen:helper ismemberof, $user, 3}, 'background: black;'}">
    			<xen:avatar user="$user" size="m" />
    			<!-- slot: message_user_info_avatar -->
    <xen:if is="!{$isQuickReply}">
    	<xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    		<h3 class="userText" style="{xen:if {xen:helper ismemberof, $user, 3}, 'background: black;'}">
    			<xen:username user="$user" itemprop="name" rich="true" />
    			<xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
    			<!-- slot: message_user_info_text -->
    I am using inline styling for quick testing. You can move it to the CSS if you want.

    The result:

    Screen shot 2011-05-26 at 12.29.36 PM.png
  3. addaco

    addaco Member

    thanks, it works :) Im using a blue hex btw.

    One last thing, the arrow/triangle and the border, can they be changed?

    Im looking through the template as I type :)

Share This Page