I would like to get the url of the avatar of a member having only the nickname. Thank you for your help.
if($mybb->user['username'] == $username)
{
$avatar = $mybb->user['avatar'];
}
else
{
$query = $db->simple_select('users', 'avatar', "username = ".$db->escape_string($username)."'", array('LIMIT' => 1));
$avatar = $db->fetch_field($query, 'avatar');
}
Where $username is the username of the user and the returned $avatar is the URL of the avatar.
Or, by using the inbuilt function:
if($mybb->user['username'] == $username)
{
$avatar = $mybb->user['avatar'];
}
elseif(get_user_by_username($username, array('exists' => true)) !== False)
{
$user = get_user_by_username($username, array('fields' => array('avatar'))); // Add other fields you want to the fields array.
$avatar = $user['avatar'];
}
else
{
error('Invalid user');
}
Also post at the MyBB Community Forums as that is where the MyBB Group provide official support.