vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Query help - retrieve avatar (https://vborg.vbsupport.ru/showthread.php?t=49991)

geniuscrew 03-11-2003 11:59 PM

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 :D

Thanks

mr e 03-12-2003 01:10 AM

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]

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:

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">'

;)

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
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 :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?

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

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


All times are GMT. The time now is 12:54 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.02020 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete