Hide avatar for guests

fredrikse

Active member
Hi,

I'm interested in an add-on that hide profile avatars for guests visiting the forum. Does it exist or can it be made easily?
 
Just add <xen:if is="{$visitor.user_id}"> on message_user_info before the avatar holder and remember to close it after it. It should not show the avatar to guests.
 
Thanks!

I found this code:

PHP:
<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <div class="avatarHolder"><span class="online_dot"></span><xen:avatar user="$user" size="m" itemprop="photo" />
        </div>
    </xen:hook>

I want the avatar with a "?" to be visible to the guests and the normal avatar for registered user. Is that hard to accomplish?

Would the initial code modification look like this:

PHP:
<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <div class="avatarHolder"><span class="online_dot"></span><xen:if is="{$visitor.user_id}"><xen:avatar user="$user" size="m" itemprop="photo" /></xen:if>
        </div>
    </xen:hook>
 
I just tried with TMS. The avatar was removed completely which I also suspected. Where does the picture come from when a user has not chosen an avatar?

The avatar is visible on many places in the XenForo installation. Is there a smart way to get close to the code which I assume is used through out the site?
 
From what I can see from the code this part is what creates the actual avatar:

Code:
<xen:avatar user="$user" size="m" itemprop="photo" />

To all unregistered visitors I want to show the avatar with the question mark.

When I look at the final HTML code it looks like this:

Code:
<div class="avatarHolder"><span class="online_dot"></span><a href="index.php?members/albin.189/" class="avatar Av189m" itemprop="photo" data-avatarHtml="true"><span class="img m" style="background-image: url('styles/default/xenforo/avatars/avatar_m.png')"></span></a>
        </div>

I have tried different this with TMS but I can't get the right presentation to the guests in terms of what avatar that is showing up.

Anyone who has tried to achieve the same result here?
 
Top Bottom