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

No avatar if none is provided

Adam Howard

Well-known member
#1
XenForo uses the simple grey avatars when a member does not upload their own. I would love an option that if someone does not supply an avatar, no avatar is displayed for that member.

So rather than this:
J0u1P1k.png

You would have this (if no avatar was uploaded by the user)
rAbKh8y.png

I think is more cleaner looking than seeing the same dull 'default' repeated.
 
Last edited:

Adam Howard

Well-known member
#3
If you want to achieve that now, it can be done with a template edit and conditional statement.
Oh really? Yes please, do share this knowledge.

I tried doing this myself via template edit, but was fairly sure it would need some sort of code change in the core files.
 

Russ

Well-known member
#4
Oh really? Yes please, do share this knowledge.

I tried doing this myself via template edit, but was fairly sure it would need some sort of code change in the core files.
Haven't really tested it much but in message_user_info:

Code:
  <xen:if is="{$user.avatar_date} AND {$user.gravatar}">
     <div class="avatarHolder">
       <span class="helper"></span>
       <xen:avatar user="$user" size="m" img="true" />
       <!-- slot: message_user_info_avatar -->
     </div>
     </xen:if>
Add the conditional around the avatarholder div.

preavatar.png

preavatar2.png
 

Adam Howard

Well-known member
#5
Haven't really tested it much but in message_user_info:

Code:
  <xen:if is="{$user.avatar_date} AND {$user.gravatar}">
     <div class="avatarHolder">
       <span class="helper"></span>
       <xen:avatar user="$user" size="m" img="true" />
       <!-- slot: message_user_info_avatar -->
     </div>
     </xen:if>
Add the conditional around the avatarholder div.

View attachment 72883

View attachment 72884
NOPE. :(

That hides everyone's avatar.

What I want is if no avatar is supplied, that none will be shown. But if you supply an avatar, yours should show. ;)
 

Russ

Well-known member
#9
Again, not what I'm talking about or looking for.

Let's use this thread as an example
http://xenforo.com/community/threads/may-day-2014.73331/#post-759721

How it is NOW
View attachment 72887


What I am suggesting (looking for)
View attachment 72886
Try this instead?

Code:
    <xen:if is="!{$user.avatar_date} AND !{$user.gravatar}">
     <xen:else />
     <div class="avatarHolder">
       <span class="helper"></span>
       <xen:avatar user="$user" size="m" img="true" />
       <!-- slot: message_user_info_avatar -->
     </div>
     </xen:if>
:
Screenshot_1.png

I'm no good with conditionals :)
 

Newt

Active member
#18
Was looking to do the same and realized that for branding purposes, something like this would be even better. Just replace the default avatars.

Just sayin' :D

Sans-titre-2.png