MyBB Community Forums

Full Version: Showing the Avatar in the header
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was trying something different with a design that I was working on. I am using the header to also house a vertical menu. The coding was fairly simple (just plow everything into the header template and then tool it so that the forum area shows in a td). Everything worked great. Then I got a brain storm to have an area near the top of my vertical menu that would show the users avatar or a guest avatar if unregistered.

I had this code.
if($mybbuser['avatar'])
	{
	$avatar = "<img src=\"".$mybbuser['avatar']."\">";
	}
	else { 
    $avatar = "<img src=\"images/avatars/noavatar.gif\">"; 
    }
I went ahead and placed this in the global.php file and presto my current avatar was shown in that area on my menu and a no image avatar was shown when I wasn't logged in with another browser. Everything was just great. This carried over to every page and looked great since the $avatar was placed in the header template.

Until.....I tried to change avatars.
No mater what I did, the avatar remained the same. I get the feeling that the code I used somehow nullifies the workings of the user cp avatar change area.

any clue on where I should go with this? or maybe a possible fix?

Attached is an image of what I am trying to do to better understand.
[attachment=489]
the code looks correct and is almost the same as my welcome panel mod code I used, except you have the extra else part. Try using just
if($mybbuser['avatar'])
{
$avatar = "<img src=\"".$mybbuser['avatar']."\">";
}
and see what happens.
same thing happens, still cannot change avatars unless it is removed from global.php

Maybe there is a certain place that I should try to place it there?
$avatar is a variable posted on the change avatar page which is why it is overwriting the one you select. Try using a different variable in your script.
The_Altered1 Wrote:same thing happens, still cannot change avatars unless it is removed from global.php

Maybe there is a certain place that I should try to place it there?

Beautiful m8, that did the trick. Thanx TONS!!!