Jump to the post that solved this thread.
Not Solved Default avatar not showing up
#1
Not Solved
[Image: 705706Capture.png]

Hi everyone, 

So here is my problem, I have the default_avatar.gif and another .png version of it also. But it's not showing up... As a grasphist I don't like a broken picture on my Forum  Dodgy

Here is the link to it : http://www.les-as-du-web.esy.es/
Reply
#2
Not Solved
Where is that broken image? Is it in user header welcomeblock?

If I have to be logged in to see it please provide a test account.
Hello I'm Wally, the administrator of Sharree.com
Reply
#3
Not Solved
(2017-03-31, 10:21 PM)Sharree Wrote: Where is that broken image? Is it in user header welcomeblock?

If I have to be logged in to see it please provide a test account.

I sended you a private message with the informations =)
Reply
#4
Not Solved
Ok sec. I'll take a look at it now,

Alright so it seems that in your member_welcomeblock in your header template your avatar code appears like so

<img src="http://les-as-du-web.esy.es/{$mybb->user['avatar']}" height="50" width="50">

Remove your forum url from the src, that is why the image is breaking. The code should be
<img src="{$mybb->user['avatar']}" height="50" width="50" class="header_avatar" >

The reason for the header_avatar class is to make default avatar appear if no avatar is uploaded, so add this script to your header code as well (Source: iAndrew)
<script>
$(document).ready(function() {
//create a default avatar for those without one.
if($('.header_avatar img', this).attr('src') == ''){
$('.header_avatar img').attr('src', "images/default_avatar.png");
}
});
</script>


Let me know if that worked for you.
Hello I'm Wally, the administrator of Sharree.com
Reply
#5
Not Solved
header
Options
header_menu_calendar
Options
header_menu_memberlist
Options
header_menu_portal
Options
header_menu_search
Options
header_quicksearch
Options
header_welcomeblock_guest
Options
header_welcomeblock_member
Options
header_welcomeblock_member_admin
Options
header_welcomeblock_member_moderator
Options
header_welcomeblock_member_pms
Options
header_welcomeblock_member_search
Options
header_welcomeblock_member_user
Options


Here are my sections in the template ...
Reply
#6
Not Solved
header_welcomeblock_member
Hello I'm Wally, the administrator of Sharree.com
Reply
#7
Not Solved
<span style="float:left;"><img src="{$mybb->settings['bburl']}/{$mybb->user['avatar']}" height="50" width="50">&nbsp;</span><div id="paneltext">{$lang->welcome_back} <br> <a href="{$mybb->settings['bburl']}/usercp.php"><img src="images/alphagaming/usercp.png"></img>&nbsp;<strong>{$lang->welcome_usercp}</strong> </a>{$modcplink}{$admincplink} <a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}"><img src="images/alphagaming/logout.png" alt="log out"/></img>&nbsp;{$lang->welcome_logout}</a></div><br />

Here is what I have in "header_welcomeblock_member"
Reply
#8
Not Solved
Replace
<img src="{$mybb->settings['bburl']}/{$mybb->user['avatar']}" height="50" width="50">

with
<img src="{$mybb->user['avatar']}" height="50" width="50" class="header_avatar" >

And at the very start of your header_welcomeblock_member template code add this
<script>
$(document).ready(function() {
//create a default avatar for those without one.
if($('.header_avatar img', this).attr('src') == ''){
$('.header_avatar img').attr('src', "images/default_avatar.png");
}
});
</script>
Hello I'm Wally, the administrator of Sharree.com
Reply
#9
Not Solved
<script>
$(document).ready(function() {
//create a default avatar for those without one.
if($('.header_avatar img', this).attr('src') == ''){
$('.header_avatar img').attr('src', "images/default_avatar.png");
}
});
</script>

<span style="float:left;"><img src="{$mybb->user['avatar']}" height="50" width="50" class="header_avatar" >&nbsp;</span><div id="paneltext">{$lang->welcome_back} <br>   <a href="{$mybb->settings['bburl']}/usercp.php"><img  src="images/alphagaming/usercp.png"></img>&nbsp;<strong>{$lang->welcome_usercp}</strong>   </a>{$modcplink}{$admincplink} <a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}"><img src="images/alphagaming/logout.png"  alt="log out"/></img>&nbsp;{$lang->welcome_logout}</a></div><br />


So here is what I have, and the result is that it's now an empty white sqare.

Reply
#10
Not Solved
Alright if you want the easiest solution without a script let's do this

Remove the SCRIPT code completely

And then take
<img src="{$mybb->user['avatar']}" height="50" width="50" class="header_avatar" >

and replace it with
<img src="{$mybb->user['avatar']}" height="50" width="50" style="background: url(images/default_avatar.png);background-size:50px 50px;">


This is a quick inline style solution, if a user has an avatar uploaded it will overlap the default, if there is no uploaded avatar it will show the default.
Hello I'm Wally, the administrator of Sharree.com
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)