PDA

View Full Version : Query help - retrieve avatar


geniuscrew
03-11-2003, 11:59 PM
I'm trying to write a hack and need to retrieve the user's avatar, whatever it is - ie custom or one that's already on the boards.

I know there are are loads of tables involved and probably some joining queries. However it's been a year since I did them and I'm a lil' rusty :D

Thanks

mr e
03-12-2003, 01:10 AM
something like that, just copied it from avatar.php ;)


$DB_site->query_first("SELECT avatardata,dateline,filename FROM customavatar WHERE userid=".intval($userid))

Velocd
03-12-2003, 04:30 AM
That query will get you the data from the custom avatar table only, and is also redundant since you have to go through the coding to actually display the avatar.

The predefined vBulletin function, from functions.php, getavatarurl(), does this all for you.

Simply use this code whenever you want to display the users avatar:



$avatarurl=getavatarurl($bbuserinfo[userid]);

/*
if ($avatarurl=='') {

$avatarurl='https://vborg.vbsupport.ru/images/avatars/noavatar.gif'; // displays a noavatar image, if the user has no avatar

}
*/

$avatarimage='<img src="'.$avatarurl.'" border="0">';


;)

geniuscrew
03-12-2003, 06:38 AM
Thanks guys for your help :)

Edit: Sorry I don't think I explained my self properly :p. I would like a link in each post which opens a new window displaying the users avatar.


Also I guess I'll be needing a variable too :)

mr e
03-12-2003, 09:53 PM
doh! my bad :)

if you want a link in each post then in admin/functions.php find this line

// do posts from ignored users

and do this above it

$avatarurl = getavatarurl($bbuserinfo[userid]);
$avatarlink = 'put java window popup code here, i tried, but suck at java popup so i couldn\\'t get it to work';


then put $avatarlink wherever you want in the postbit

lol hope this helps at all :rolleyes: ;)

geniuscrew
03-13-2003, 12:21 AM
Thanks E,

I'll try that

geniuscrew
03-13-2003, 12:31 AM
So is this correct?

$avatarurl = getavatarurl($bbuserinfo[userid]); {
eval("\$avatarlink .= \"".gettemplate('editav')."\";");

}

I wanna add aditional code to that pop up, so i thought the best way would be to use a template instead.


Thanks again

mr e
03-13-2003, 02:12 AM
if you have the link and the pop up code inside editav im pretty sure that should work :), but like i've said, i dont think i've EVER gotten popup code to work, not really sure why, so hope you get it to work :D

geniuscrew
03-13-2003, 03:48 PM
I nicked it from another hack :)

mr e
03-13-2003, 09:18 PM
lol, that's good, even when i steal popup code from other sites it won't work for me...go figure :D