Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2005, 07:59 PM
sayian sayian is offline
 
Join Date: Jun 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Where is the avatar code?

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.
Reply With Quote
  #2  
Old 06-09-2005, 08:05 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

functions_user,php => fetch_avatar_url() and image.php
Reply With Quote
  #3  
Old 06-09-2005, 09:02 PM
sayian sayian is offline
 
Join Date: Jun 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

Code:
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03608 seconds
  • Memory Usage 2,185KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete