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

show thread-content, but do not show avatar ?

erich37

Well-known member
#1
I would like to show the thread-content, but do not want to show the user-avatar to guests.
Only registered members should see the member-avatars.


Is there a chance to do this?

I think I remember there was an add-on for that, but can not find it anymore....


Appreciate your help!
 

erich37

Well-known member
#5
Hi Jake,

I think what would be great is this:

- show the default avatar-image (the default grey-colored male/female image), so meaning show whether user is "male" or "female". But do not show the "real" avatar-image (the image which was uploaded by the user) of the member to guests.
- when guest is clicking onto the avatar, then he will be forwarded to the "Log-in / Sign-up" page.

Would you be so kind to help with the code for this ?

Appreciate your help! Many thanks! :)

This would help to change my Forum from being a "Private Community" towards making the "thread-content" public. Because I need to respect the privacy of my members......
 

Jake Bunce

XenForo moderator
Staff member
#6
Just change the condition to check for the user_id of the visitor:

Code:
	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
		<div class="avatarHolder">
			<xen:if is="!{$visitor.user_id}">
				<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/GUESTAVA.GIF')"></span></a>
			<xen:else />
				<xen:avatar user="$user" size="m" />
				<!-- slot: message_user_info_avatar -->
			</xen:if>
		</div>
	</xen:hook>
 

erich37

Well-known member
#7
Code:
style="background-image: url('PATH/TO/GUESTAVA.GIF')

wouldn't there be 2 different images for "guestava.gif" ?
One for "male" and another one for "female" ?

So I would like to use 2 custom images (same as the default grey-image, but put a text onto it like "Image visible for members only"...).
 

Jake Bunce

XenForo moderator
Staff member
#8
Then do this:

Code:
	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
		<div class="avatarHolder">
			<xen:if is="!{$visitor.user_id}">
				<xen:avatar user="$user" size="m" forcetype="default" />
				<!-- slot: message_user_info_avatar -->
			<xen:else />
				<xen:avatar user="$user" size="m" />
				<!-- slot: message_user_info_avatar -->
			</xen:if>
		</div>
	</xen:hook>
You can use xen:avatar with forcetype="default"
 

erich37

Well-known member
#9
Then do this:

Code:
<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
<div class="avatarHolder">
<xen:if is="!{$visitor.user_id}">
<xen:avatar user="$user" size="m" forcetype="default" />
<!-- slot: message_user_info_avatar -->
<xen:else />
<xen:avatar user="$user" size="m" />
<!-- slot: message_user_info_avatar -->
</xen:if>
</div>
</xen:hook>
You can use xen:avatar with forcetype="default"
I tried this, but unfortunately, the small user-avatar is still showing the "real" user-image (which has been uploaded by the user).
The other issue is that the thread-content is not visible. Not sure why ?
 

Jake Bunce

XenForo moderator
Staff member
#10
I tried this, but unfortunately, the small user-avatar is still showing the "real" user-image (which has been uploaded by the user).
The other issue is that the thread-content is not visible. Not sure why ?
It will show the default avatars if you are viewing as a guest, and only on thread pages.
 

erich37

Well-known member
#11
I have tried all of this, but it is still not working....... :(

is there a way to also hide the uploaded user-image at the "Thread-List"-pages ? And show the default grey (male / female) avatar instead ?

I am running a Dating Community and would like to show all thread-content, but not the uploaded avatar-image of the members.

Appreciate your help!
 

Jake Bunce

XenForo moderator
Staff member
#12
Rather than modify every avatar call in multiple templates, you might consider modifying the actual function to affect all instances:

XenForo_Template_Helper_Core::helperAvatarHtml

You can modify this function to get the visitor object and set $forceType appropriately. This requires PHP code.
 

erich37

Well-known member
#13
Hi Jake,

what would be the template for achieving this in the "thread-list" view ?

I only need to hide the "uploaded avatar (user pic)" at the thread-view and at the thread-list. So just showing the grey-colored default avatar-image at those...


Many thanks!