vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to know does user have avatar or not? (https://vborg.vbsupport.ru/showthread.php?t=159037)

ApplePro 09-29-2007 01:52 PM

How to know does user have avatar or not?
 
Hello guys,

I'm trying to know about have user avatar or not. I'm looking into userinfo array:

print_r($vbulletin->userinfo);

And I see this in it for both user that has avatar and user that has not:

[avatarid] => 0 [avatarrevision] => 0

In both cases it's 0. :confused:

Dismounted 09-30-2007 06:18 AM

PHP Code:

// include backend
require_once('./global.php');
require_once(
DIR '/includes/functions_user.php');

// setup avatar if exists
$avatar fetch_avatar_url($vbulletin->userinfo['userid']);
if (empty(
$avatar) AND $vbulletin->options['avatarenabled'])
{
    
// user has no avatar



ApplePro 09-30-2007 09:17 AM

Quote:

Originally Posted by Dismounted (Post 1350025)
PHP Code:

// include backend
require_once('./global.php');
require_once(
DIR '/includes/functions_user.php');

// setup avatar if exists
$avatar fetch_avatar_url($vbulletin->userinfo['userid']);
if (empty(
$avatar) AND $vbulletin->options['avatarenabled'])
{
    
// user has no avatar



Thanks for advice. I've tried it, but I get error message "Database error".

I've changed it little bit. I've used this:

PHP Code:

$forumpath2 "/home/user/forums/";
require_once(
$forumpath2.'global.php');
require_once(
$forumpath2.'includes/functions_user.php'); 

instead of this:

PHP Code:

require_once('./global.php');
require_once(
DIR '/includes/functions_user.php'); 


Dismounted 09-30-2007 09:20 AM

PHP Code:

// change working dir
$curdir getcwd();
chdir('/home/user/forums');

// include backend
require_once('./global.php');
require_once(
DIR '/includes/functions_user.php');

// setup avatar if exists
$avatar fetch_avatar_url($vbulletin->userinfo['userid']);
if (empty(
$avatar) AND $vbulletin->options['avatarenabled'])
{
    
// user has no avatar
}

// bring back to proper directory
chdir($curdir); 


ApplePro 09-30-2007 09:32 AM

I've made this work by this adding these lines into login_inc mod:

PHP Code:

$file $forumpath."image.php?u=$userid";
list(
$width$height$type) = getimagesize($file);

if  (
$width == 1){
    
//User has no avatar


I seems your code doesn't work for me, because I'm using it inside login_inc.php.

But still thanks for your advices.


All times are GMT. The time now is 08:30 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.01022 seconds
  • Memory Usage 1,736KB
  • 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
  • (6)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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