Hide Message Elements

lostincable

Active member
Hi there, I have looked high and low for this and I know its going to be simple so here goes.

I am wanting to hide the message elements from guests?

I have looked everywhere and can not find it!!!

Any ideas? Is it possible?

Cheers!
 
It's actually only possible really with template edits... but that's not a big problem.

I assume you're talking about things like post count, custom fields, register date etc. that you can activate in Style Properties > Message Elements?

If so, you need the template message_user_info.

Add the code in red to hide the elements from guests. I've chosen to add the check individually on each element as this will give you the flexibility to pick and choose which you do want to show or don't:

Rich (BB code):
	<xen:if hascontent="true">
		<div class="extraUserInfo">
			<xen:contentcheck>
			<xen:hook name="message_user_info_extra" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
				<xen:if is="@messageShowRegisterDate AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase member_since}:</dt>
						<dd>{xen:date $user.register_date}</dd>
					</dl>
				</xen:if>
				
				<xen:if is="@messageShowMessageCount AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase message_count}:</dt>
						<dd><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}" class="concealed">{xen:number $user.message_count}</a></dd>
					</dl>
				</xen:if>
				
				<xen:if is="@messageShowTotalLikes AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase likes_received}:</dt>
						<dd>{xen:number $user.like_count}</dd>
					</dl>
				</xen:if>
				
				<xen:if is="@messageShowTrophyPoints AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase trophy_points}:</dt>
						<dd><a href="{xen:link 'members/trophies', $user}" class="OverlayTrigger concealed">{xen:number $user.trophy_points}</a></dd>
					</dl>
				</xen:if>
			
				<xen:if is="@messageShowGender AND {$user.gender} AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase gender}:</dt>
						<dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd>
					</dl>
				</xen:if>
				
				<xen:if is="@messageShowOccupation AND {$user.occupation} AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase occupation}:</dt>
						<dd itemprop="role">{xen:string censor, $user.occupation}</dd>
					</dl>
				</xen:if>
				
				<xen:if is="@messageShowLocation AND {$user.location} AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase location}:</dt>
						<dd><a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $user.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $user.location}</a></dd>
					</dl>
				</xen:if>
			
				<xen:if is="@messageShowHomepage AND {$user.homepage} AND $visitor.user_id">
					<dl class="pairsInline">
						<dt>{xen:phrase home_page}:</dt>
						<dd><a href="{xen:string censor, $user.homepage, '-'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>
					</dl>
				</xen:if>
							
			</xen:hook>			
			<xen:if is="@messageShowCustomFields AND {$user.customFields} AND $visitor.user_id">
			<xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
			
				<xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
					<xen:if is="{$fieldInfo.viewable_message}">
						<xen:if hascontent="true">
							<dl class="pairsInline userField_{$fieldId}">
								<dt>{xen:helper userFieldTitle, $fieldId}:</dt>
								<dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
							</dl>
						</xen:if>
					</xen:if>
				</xen:foreach>
				
			</xen:hook>
			</xen:if>
			</xen:contentcheck>
		</div>
	</xen:if>
 
Thanks for this, ChrisD!

I had to do a little change to make it run in 1.3.2. If someone is looking for the same, here are the necessary changes

Instead of:

Code:
<xen:if is="@messageShowRegisterDate AND $visitor.user_id">

i had to use:

Code:
<xen:if is="@messageShowRegisterDate AND {$visitor.user_id"}>

But with that it works perfectly.[/code]
 
Top Bottom