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

When user has no avatar - is smaller avatar block available?

Discussion in 'XenForo Questions and Support' started by craigiri, Jan 21, 2012.

  1. craigiri

    craigiri Well-Known Member

    As the title says - many conversations involve short sentences and posts - yet XF themes often take up a lot of room with the avatar holding area, so lots of scrolling has to be done.

    Is there a way to make it so when the user has not uploaded an avatar, that the block is shorter?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> message_user_info

    Replace the red code:

    Code:
    	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    		<div class="avatarHolder">
    			<span class="helper"></span>
    			<xen:avatar user="$user" size="m" />
    			<!-- slot: message_user_info_avatar -->
    		</div>
    	</xen:hook>
    
    Like so:

    Code:
    	<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    		<div class="avatarHolder">
    			<span class="helper"></span>
    
    			<xen:if is="{$user.avatar_date} OR {$user.gravatar}">
    				<xen:avatar user="$user" size="m" />
    			<xen:else />
    				<xen:avatar user="$user" size="s" />
    			</xen:if>
    
    			<!-- slot: message_user_info_avatar -->
    		</div>
    	</xen:hook>
    
    The result:

    Screen shot 2012-01-22 at 1.04.43 AM.png
     
  3. craigiri

    craigiri Well-Known Member

    Cool, Jake!
    Thanks. Thats's one way of doing it.
    I suppose the same code could probably call a completely different avatar or place keeper....one which was as wide as the big avatar, but only a could pixels high....
     

Share This Page