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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-11-2003, 11:59 PM
geniuscrew's Avatar
geniuscrew geniuscrew is offline
 
Join Date: Nov 2001
Location: UK
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Query help - retrieve avatar

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

Thanks
Reply With Quote
  #2  
Old 03-12-2003, 01:10 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

something like that, just copied it from avatar.php

[sql]
$DB_site->query_first("SELECT avatardata,dateline,filename FROM customavatar WHERE userid=".intval($userid))
[/sql]
Reply With Quote
  #3  
Old 03-12-2003, 04:30 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

PHP Code:

$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">'
Reply With Quote
  #4  
Old 03-12-2003, 06:38 AM
geniuscrew's Avatar
geniuscrew geniuscrew is offline
 
Join Date: Nov 2001
Location: UK
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks guys for your help

Edit: Sorry I don't think I explained my self properly . 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
Reply With Quote
  #5  
Old 03-12-2003, 09:53 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
PHP Code:
$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
Reply With Quote
  #6  
Old 03-13-2003, 12:21 AM
geniuscrew's Avatar
geniuscrew geniuscrew is offline
 
Join Date: Nov 2001
Location: UK
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks E,

I'll try that
Reply With Quote
  #7  
Old 03-13-2003, 12:31 AM
geniuscrew's Avatar
geniuscrew geniuscrew is offline
 
Join Date: Nov 2001
Location: UK
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So is this correct?

PHP Code:
$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
Reply With Quote
  #8  
Old 03-13-2003, 02:12 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 03-13-2003, 03:48 PM
geniuscrew's Avatar
geniuscrew geniuscrew is offline
 
Join Date: Nov 2001
Location: UK
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I nicked it from another hack
Reply With Quote
  #10  
Old 03-13-2003, 09:18 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol, that's good, even when i steal popup code from other sites it won't work for me...go figure
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 05:47 PM.


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.06387 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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