Template files see if user is banned

blackvoid

Active member
I would like to see if the user is banned in the view message template. If the user is banned it will show a static image url and if not it will show the users avatar.

I couldnt find a user variable to check this.

Best regards
 
Quick and dirty template edit:

Admin CP -> Appearance -> Templates -> message_user_info

Replace this code:

Code:
	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
		<div class="avatarHolder">
			<xen:avatar user="$user" size="m" />
			<!-- slot: message_user_info_avatar -->
		</div>
	</xen:hook>

With this:

Code:
	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
		<div class="avatarHolder">
			<xen:if is="{$user.is_banned}">
				<a href="{xen:link members, $user}" class="avatar Av{$user.user_id}m" data-avatarHtml="true"><span class="img m" style="background-image: url('PATH/TO/BANNEDIMAGE.GIF')"></span></a>
			<xen:else />
				<xen:avatar user="$user" size="m" />
				<!-- slot: message_user_info_avatar -->
			</xen:if>
		</div>
	</xen:hook>

You need to change PATH/TO/BANNEDIMAGE.GIF appropriately. And ideally the image should be 96x96 to match the size of other avatars.

This is hard-coding the avatar HTML so it isn't future-proof should the avatar code change in a future version.
 
Top Bottom