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

Hide avatar for guests

Discussion in 'Resource and Add-on Requests' started by fredrikse, Oct 8, 2012.

  1. fredrikse

    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?
     
  2. arcaneex

    arcaneex Active Member

    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.
     
  3. fredrikse

    fredrikse Active Member

    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="$usersize="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="$usersize="m" itemprop="photo" /></xen:if>
            </
    div>
        </
    xen:hook>
     
  4. fredrikse

    fredrikse Active Member

    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?
     
  5. fredrikse

    fredrikse Active Member

    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?
     

Share This Page