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 02-10-2008, 04:14 AM
Greg-J Greg-J is offline
 
Join Date: Jul 2006
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Accessing user/cookie info outside of vBulletin

I'm creating a pseudo-marketplace outside of vbulletin and I'm running into a snag where I think many people do and I can't seem to find the solution I'm after.

I really need to be able to know if a user is logged into vbulletin and if they are, get their messages information, (userid, # of new/old messages etc.) and other things like the popup notification when they get a new message (although that's trivial at this point).

Any help would be much appreciated. I'm really just looking to know what vbulletin files/functions/classes I need to be using/including and any tips you might have the subject.
Reply With Quote
  #2  
Old 02-10-2008, 07:04 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is a wealth of information on these forums and in the articles section covering this. Try searching for some obvious keywords.

Not being a smartass, just reminding you that "Search" is your friend.

-- hugh
Reply With Quote
  #3  
Old 02-11-2008, 05:41 AM
Greg-J Greg-J is offline
 
Join Date: Jul 2006
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've searched and browsed quite a bit but I'm either not using the right keywords or they don't exist. I wouldn't have posted the question before I looked for the answer myself.

That said, the only in depth article I found involved doing this at the apache level which is not an appropriate solution for my application.

Again; any help would be much appreciated.
Reply With Quote
  #4  
Old 02-11-2008, 06:53 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Include vBulletin's global.php. That will give you the essential functions including if the user is logged in or not.
Reply With Quote
  #5  
Old 02-12-2008, 01:57 AM
Greg-J Greg-J is offline
 
Join Date: Jul 2006
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
Include vBulletin's global.php. That will give you the essential functions including if the user is logged in or not.
This seems to only work if you're including that file from within the same directory, which I am not. Even so, when I do move into the directory vB is installed and include the file I am presented with a no referrer error (not a big deal), but if I'm not logged in I get an odd mix of errors and partial html which just isn't going to work.

I apologize for the ignorance, but surely there must be hundreds of people who have done this and have documented it somewhere?
Reply With Quote
  #6  
Old 02-12-2008, 04:20 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It has, and most times, the solution was posted by me .
PHP Code:
$curdir cwd();
chdir('./forum/');
require_once(
'/global.php');
chdir($curdir); 
Reply With Quote
  #7  
Old 02-12-2008, 06:55 AM
Greg-J Greg-J is offline
 
Join Date: Jul 2006
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh, thank you.

Now, about the no http referrer/not logged in issues. Got anything for those?


UPDATE:

Your code must have been written on the fly This is what works:

PHP Code:
$curdir getcwd();
chdir('./forum/');
require_once(
'global.php');
chdir($curdir); 
Could still use some help on the bit about someone being logged in or not. Cheers.
Reply With Quote
  #8  
Old 02-12-2008, 08:06 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, sorry, I typed the code out, it would've taken longer for me to copy and paste .
PHP Code:
if (!empty($vbulletin->userinfo['userid']))
{
    
// user is logged in
}
else
{
    
// user is not logged in/guest

Reply With Quote
  #9  
Old 02-12-2008, 07:55 PM
Greg-J Greg-J is offline
 
Join Date: Jul 2006
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cheers, but....


The issue isn't that the class is empty, it's that somewhere throughout the process in global.php. View this page to see what I mean:

http://www.myspacepros.com/_test.php
Reply With Quote
  #10  
Old 02-13-2008, 04:06 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You might need to set the Cookie Domain/Path properly for it to recognise logged in users.
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 01:37 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.14430 seconds
  • Memory Usage 2,263KB
  • 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
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete