Replace above PHP code with this;
Now find the following in your header template;
if (!empty($mybb->user['avatar']))
{
$avatar = '<img src="'.$mybb->user['avatar'].'" width="100px"
height="100px" style="border: 2px solid #fff; border-radius: 5px;
-webkit-border-radius: 5px; -moz-border-radius: 5px;">';
}
else
{
$avatar = "";
}
Now find the following in your header template;
<img src="{$mybb->user['avatar']}" width="100px"
height="100px" style="border: 2px solid #fff; border-radius: 5px;
-webkit-border-radius: 5px; -moz-border-radius: 5px;">
and Replace it to;{$avatar}