Hi i have a site, behind that (/forum) is the forum, I wanna show a random, activated member on the main page, with members avatar, name, link to profile and joined date, postcount.
Site is here www.initial.net.nz forum www.initial.net.nz/forum
Im ok with php&mysql I can get the member stuff ok, not sure where the avatar info is and hows best to get and display it.
ANY HELP APPRECIATED.
Hımmm, you can use this:
$member_id = 'USER_ID_HERE';
loadMemberData($member_id);
loadMemberContext($member_id);
And then you can use:
$memberContext[$member_id]['avatar']['image']
to display the avatar.
You will be able to fetch all the data about this member by this function. You can use var_dump() to see what you have in $memberContext[$member_id].
Hi, thanks for the reply but im not using the smf api so loadmemberdata() is not available, im using this:
SELECT * FROM smf_members WHERE is_activated='1' order by rand() limit 1"
I then get the member_id, which im assuming i need to use in the next statement to get a matching avatar? just need to know where the avatar info is.
thanks.
Lainaus käyttäjältä: Sadrazam - kesäkuu 05, 2008, 11:33:26 AP
Hımmm, you can use this:
$member_id = 'USER_ID_HERE';
loadMemberData($member_id);
loadMemberContext($member_id);
And then you can use:
$memberContext[$member_id]['avatar']['image']
to display the avatar.
Try that.
Hi did u read my post? $memberContext[$member_id]['avatar']['image'] is not available, im NOT using the smf API to do this, Im connecting to sql with my own thing, getting the data from smf_members, which includes the member_id, postcount, member name and date.
Why do you need to do your own thing when there's already a system built in? Sigh.....
Two Options for you.
1) Analyze /Sources/load.php and find where the member id array is populated, thus giving you access to all sorts of fun things
2) Look under the "avatar" column of smf_members (Shocker, I know). If it's an absolute URL there you go, if it's relative, it's relative to forum/avatars
Im using my own cuz the smf api interferes with another cms system.
OH GODAMMIT! I didnt see the avatar column. Duh. thanks, my random user mod/thing is completed.
Interesting.... SSI.php is my best friend. Not only for the functions, but it loads up all the info too.
And I know the feeling, it took me about 15 minutes to find that column when I was doing some avatar work.
however....uploaded avatars are not in the avatar column, only remote and avatar gallery ones....HELP.
Lainaus käyttäjältä: Sadrazam - kesäkuu 05, 2008, 11:33:26 AP
Hımmm, you can use this:
$member_id = 'USER_ID_HERE';
loadMemberData($member_id);
loadMemberContext($member_id);
And then you can use:
$memberContext[$member_id]['avatar']['image']
to display the avatar.
You will be able to fetch all the data about this member by this function. You can use var_dump() to see what you have in $memberContext[$member_id].
I'm having the same issue, trying to display a avatar based on the user id, i've used the above code but i get this error:
LainaaNotice: Undefined variable: memberContext in C:\Apache\htdocs\sys_config\sql.php on line 658
Hi, this is a diff kinda thing here man, Im not using the SMF code, only the database.
Im using this:$mSQLm = mysql_query("SELECT * FROM smf_members WHERE is_activated='1' AND posts > 0 order by rand() limit 1");
while($mms = mysql_fetch_array($mSQLm))
{
$M_ID = $mms["ID_MEMBER"];
$M_NAME = $mms["memberName"];
$M_POSTCOUNT = $mms["posts"];
$M_AVATAR = $mms["avatar"];
if(file_exists("forum/avatars/$M_AVATAR"))$AVATAR = "forum/avatars/$M_AVATAR";
else
if (fopen($M_AVATAR, "r"))$AVATAR = "$M_AVATAR";
else
$AVATAR = "images/logo3i.jpg";
and just noticed that uploaded avatars are not listed here...awaiting help.
Undefined variable means your error reporting is too high, or if you wanna be anal about your code, you need to declare EVERTHING.
What is displayed in the "avatar" column if the avatar is an uploaded one?
Lainaus käyttäjältä: spearfish - kesäkuu 05, 2008, 09:50:53 IP
What is displayed in the "avatar" column if the avatar is an uploaded one?
its a blank field/NULL
which begs the question...where the hell is it??
Under the smf_attachments section.
If the column "id_member" is not zero, I'm fairly certain that means it's an avatar. The filename is listed under the "filename" column, and it should be wherever you specified attachments go.
w00t. all done! thanks guys. works perfect.
Lainaus käyttäjältä: ziycon - kesäkuu 05, 2008, 09:43:18 IP
I'm having the same issue, trying to display a avatar based on the user id, i've used the above code but i get this error:
LainaaNotice: Undefined variable: memberContext in C:\Apache\htdocs\sys_config\sql.php on line 658
$memberContext variable must be in globals.
whoo wrks perfect, worked out what kind of avatar is used, checks if it exists, if not uses a default one, also does this if user didnt even choose an avatar :) gets post count as well but not used. uses no SSI :)