vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   vb login on non vb page (https://vborg.vbsupport.ru/showthread.php?t=95661)

SilentK 09-04-2005 10:58 PM

vb login on non vb page
 
This code worked for me in 3.0.7 but broke when I upgraded to 3.5

PHP Code:

<? 
if ($bbuserinfo['userid']!=0) { 
    $username=$bbuserinfo['username']; 
     

    // i assigned the avatar url to the variable $user_av and check to see if it's empty. 
    $user_av = fetch_avatar_url($bbuserinfo['userid']); 
    if($user_av!='') 
       $user_av="/forums/" . $user_av;  //replace "/forum/" with your virtual path to your forum pages. 

    print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>"); 
     
    //if the avatar url is not empty, display it 
    if($user_av!='') 
        print("<img src=\"" . $user_av . "\" vspace=4>"); 
} else { 
?>

The forms that are displayed to login still work. The problem is it doesn't detect when someone is logged in anymore.

What changed from 3.0.7 to 3.5 that broke this and what do I need to do to fix it?

Andreas 09-05-2005 05:41 AM

$bbuserinfo has become $vbulletin->userinfo

SilentK 09-05-2005 05:16 PM

Quote:

Originally Posted by KirbyDE
$bbuserinfo has become $vbulletin->userinfo

Ok now it detects and welcome's the user but it doesn't seem to be handling the user's av url correctly. It detects if the user has one or not but the url it uses is wrong.

for some reason this is the url it comes up with.
http://www.xblteams.com/forums/Array

Andreas 09-05-2005 05:40 PM

You are using the result of fetch_avatar_url() incorrectly :)
Take a look at how member.php for example does it.

SilentK 09-05-2005 07:11 PM

Quote:

Originally Posted by KirbyDE
You are using the result of fetch_avatar_url() incorrectly :)
Take a look at how member.php for example does it.

Oh they switched it to an array interesting.

here's the working code for anyone interested.

PHP Code:

<?
if ($vbulletin->userinfo['userid']!=0) {
$username=$vbulletin->userinfo['username'];
    // i assigned the avatar url to the variable $user_av and check to see if it's empty. 
    $uinfo = fetch_avatar_url($vbulletin->userinfo['userid']);
    $user_av = $uinfo[0];    
if($user_av!='') 
       $user_av="/forums/" . $user_av;  //replace "/forum/" with your virtual path to your forum pages. 

    print("<align='center'><span class='sectionheader'>Welcome back, $username!<br>"); 
     
    //if the avatar url is not empty, display it 
    if($user_av!='') 
        print("<div align=center><img src=\"" . $user_av . "\" vspace=4></div>"); 
} else { 
?>



All times are GMT. The time now is 08:48 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.01177 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_php_printable
  • (2)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