MyBB Community Forums

Full Version: Make default avatar CSS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What condition can i use to make the default avatar display as CSS in memberlist_user_avatar template ?

Something like

<if $useravatar['image'] = images/default_avatar.png then>
	<i class="fa fa-user-circle-o"></i>	
<else>	
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>
Try with this:
<if $useravatar['image'] == "images/default_avatar.png" then>
    <i class="fa fa-user-circle-o"></i>    
<else>    
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>

or with this:
<if $useravatar['image'] == str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']) then>
    <i class="fa fa-user-circle-o"></i>    
<else>    
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>
(2017-08-13, 04:44 PM)chack1172 Wrote: [ -> ]Try with this:
<if $useravatar['image'] == "images/default_avatar.png" then>
    <i class="fa fa-user-circle-o"></i>    
<else>    
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>

Tried that already, does not work.
Try the second code
(2017-08-13, 04:56 PM)chack1172 Wrote: [ -> ]Try the second code

Still not. The CSS displays but the avatar does not display when a user has one set.
This should work:
<if $useravatar['image'] == $mybb->settings['bburl'].'/'.$mybb->settings['useravatar'] then>
    default
<else>    
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>
(2017-08-13, 05:14 PM)chack1172 Wrote: [ -> ]This should work:
<if $useravatar['image'] == $mybb->settings['bburl'].'/'.$mybb->settings['useravatar'] then>
    default
<else>    
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />
</if>

That works! Thanks.