MyBB Community Forums

Full Version: How to display user avatar on my site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I have one small problem...

I use this code to display the login form and a small menu after user is logged in on my site, and I want to display user avatar from forum but I don't know how to do this thing. Can someone help me?
<?php

if($mybb->user['uid'])
{
// The user is logged in, Display the User Menu
echo "Welcome, ".$mybb->user['username'].".<br><br>
<a href='/forum/usercp.php'>User CP</a><br>
<a href='/forum/private.php'>Mesaje Private</a><br>
<a href='Downloads.php'>Downloads</a><br/>
<form action='http://www.m-wanted.eu/forum/member.php' method='post'>
<input type='hidden' name='action' value='logout'> 
<input type='hidden' name='logoutkey' value={$mybb->user['logoutkey']}>
<input type='hidden' name='action' value='logout'>
<input type='hidden' name='url' value='../index.php' />
<input type='image' src='images/logout.png' name='submit' value='Logout' /></form><br>";
}

    
else {

     // The user is not logged in, Display the form
    echo "<form action='/forum/member.php' method='post'>
    <input type=\"hidden\" name=\"my_post_key\" value=\"$mybb->post_code\" />
    Username: <input type='text' name='username' size='15' maxlength='30' /><br />
    Password: <input type='password' name='password' size='15' />
    <input type='hidden' name='action' value='do_login'>
    <input type='hidden' name='url' value='../index.php' />
    <input type='submit' class='submit' name='submit' value='Login' /><br /><br />
	<a href='http://www.m-wanted.eu/forum/member.php?action=register'>Nu am cont</a> | <a href='http://m-wanted.eu/forum/member.php?action=lostpw'>Am uitat parola</a></br></form><br>";
}

?> 

Now after login the menu is looking like this [attachment=15160]
and I want to look like this [attachment=15161]
I've try something like this .$mybb->user['avatar']. and it shows only the url of image
/uploads/avatars/avatar_1.jpg.

my forum is in another folder called forum and I think this is the reason why it shows only the url Confused
Hello,
This might help you.

http://iwaha.co.cc/?b=2&p=3&cat=2
yupiiii..... thanks a lot webstar