PDA

View Full Version : Where is the avatar code?


sayian
06-09-2005, 07:59 PM
Hey all!

What im trying to do is find the page that controls avatars.

Here's what i wanna do

I have another site where all of my member's have their picture's and thing's .. it runs a SQL Database.

I want to write a short query in the avatar page in VB to lookup my other member's user ID from their VB user name ( The user names for my user's are both the same on VB and In my other database) Then once i lookup their user ID i can link to their image thru my php script by calling /image.php?id=USERID&pic=1

This will take all of my user's main pics from my other site and allow vb to use them as the Avatar Images

Could someone tell me what page the code to display the avatars is on?

Thanks in advance.

Andreas
06-09-2005, 08:05 PM
functions_user,php => fetch_avatar_url() and image.php

sayian
06-09-2005, 09:02 PM
Ok , ive made some modifications to the function in function_users

but now im stuck , first off , i need to know how i can find the currect username of the user in this function where username = xxxxxx in my query.

second , ive laid most of the code for me to be able to grab my user's images off the other site , but am unsure where to plus this in .. doesnt the avatar have a size limit ... id like the images to be all sized at 100 x 100 when they are displayed ... i really hope someone can help me with this b/c i am trying.


function fetch_avatar_url($userid)
{
global $DB_site, $session, $vboptions;


////////// GET MY USERS MAIN IMAGE FOR THEIR AVATAR IMAGE ////////////


define("DB_SERVER", "localhost"); // Server
define("DB_USER", "xxxxx"); // Username
define("DB_PASS", "xxxxx"); // User pass
define("DB_NAME", "xxxxx"); // Database
mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); // Connection
mysql_select_db(DB_NAME) or die(mysql_error()); // Selection of database


$check = ("SELECT id FROM shocc_users WHERE username='xxxxxxx'"); /// the name of my database table on other site

$result = mysql_query($check) or die (mysql_error());
// OK if results were found ...
if(mysql_num_rows($result) != 0){
$img_path = "/image1.php?id=" . $result . "&p=1";
} else {

$img_path = "/images/notfound.jpg";
}

//////////// END MY CODE ////////////////



if ($avatarinfo = $DB_site->query_first("
SELECT user.avatarid, user.avatarrevision, avatarpath, NOT ISNULL(avatardata) AS hascustom, customavatar.dateline
FROM " . TABLE_PREFIX . "user AS user
LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON avatar.avatarid = user.avatarid
LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON customavatar.userid = user.userid
WHERE user.userid = $userid"))
{
if (!empty($avatarinfo['avatarpath']))
{
return $avatarinfo['avatarpath'];
}
else if ($avatarinfo['hascustom'])
{
if ($vboptions['usefileavatar'])
{
return "$vboptions[avatarurl]/avatar{$userid}_{$avatarinfo[avatarrevision]}.gif";
}
else
{
return "image.php?u=$userid&dateline=$avatarinfo[dateline]";
}
}
else
{
return '';
}
}
}


Basically guy's what im trying to do is get my member's main photo to show from their profile on my other site ... i have a php script (image.php) that will server the main photo as long as i provide the user ID , so what ive done is made code that will grab their user ID from my other site based off their username from v bulliten ( the account names are the same on both sites) then i can plug the ID sql send's me back into my image.php file like this
/image.php?id=USERID&pic=1

This will return USERID's main pic ( from my other site ) Are you with me so far?

If anyone understands what im trying to do , please let me know