I'm writing a mod for my SMF 2.0 Beta 3.1 forum, and I need to get a specific user's avatar.
Is there a function in function_db, or a database query, etc. that will do this?
Thanks. :)
If you call the 'loadMemberContext($user_id)' function from 'Subs.php', then you can access a whole lot of information about each user. After you call the function, you can access the information from the $memberContext[] array, indexed by user ids. You want the $memberContext[$user_id]['avatar']['href'] or $memberContext[$user_id]['avatar']['image'] variables to get the avatar information. Its all setup by the 'loadMemberContext()'.
Thank you, but the picture still doesn't seem to come up, it's probably a problem in my code...
require_once($sourcedir . "/subs.php");
foreach($UserArray as $user)
{
loadMemberContext($user['ID']);
echo '<tr>
<td class="windowbg">
'.$memberContext[$user['ID']].'
</td>';
}
Thanks!
I just realised that you also have to call the loadMemberData() function for each member as well. ;)
Also, you need to use the $memberContext[$user['id']]['avatar']['image'] information.
Try this:
echo '
<table>';
foreach($UserArray as $user)
{
loadMemberData($user['id']);
loadMemberContext($user['id']);
echo '
<tr>
<td class="windowbg">
'.$memberContext[$user['id']]['avatar']['image'].'
</td>
</tr>';
}
echo '
</table>';
Ah, that worked, thank you!
One of the things I wasn't doing was making $memberContext a global! ;)
Thanks!