1. 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 ?

Discussion in 'XenForo Questions and Support' started by erich37, Oct 17, 2012.

  1. erich37

    erich37 Well-Known Member

    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!
     
  2. James

    James Well-Known Member

    Just create a conditional in the message_user_info template that hides the avatar.
    Code:
    <xen:if is="{$visitor.user_id}"><xen:avatar ..................... /></xen:if>
     
    Jake Bunce and erich37 like this.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  4. Digital Doctor

    Digital Doctor Well-Known Member

    Cool idea.
    Could work well for certain forums.
     
    erich37 likes this.
  5. erich37

    erich37 Well-Known Member

    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......
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  7. erich37

    erich37 Well-Known Member

    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"...).
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 and James like this.
  9. erich37

    erich37 Well-Known Member

    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 ?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It will show the default avatars if you are viewing as a guest, and only on thread pages.
     
  11. erich37

    erich37 Well-Known Member

    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!
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  13. erich37

    erich37 Well-Known Member

    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!
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> thread_list_item
     
    erich37 likes this.

Share This Page