MyBB Community Forums

Full Version: show a users avatar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can i show a users avatar through a php command if they are logged in from another part of the site, like rootdomain.org/index.php (with a login panel and some links after you login) you are logged into mybb through the root domain index.php where as mybb is located in /forum

i need to know how to display the logged in users avatar.
please, thank you, and again please! Big Grin
If you know the user ID of the user who is logged in, you can use something like this:
$query = mysql_query("SELECT avatar FROM mybb_users WHERE uid='{$uid}'");
$user = mysql_fetch_array($query);
echo "<img src='{$user['avatar']}' />";
If you already "require './global.php';" in your script, then you can simply use this:
echo "<img src='{$mybb->user['avatar']}' />";