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

changing messauge_user_info

#1
Hey

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
addaco

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
 

Jake Bunce

XenForo moderator
Staff member
#2
Like this:

Admin CP -> Appearance -> Templates -> message_user_info

Add this code:

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

Code:
<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 -->
		</div>
	</xen:hook>

<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 -->
		</h3>
	</xen:hook>
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