vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Accessing user/cookie info outside of vBulletin (https://vborg.vbsupport.ru/showthread.php?t=170110)

Greg-J 02-10-2008 04:14 AM

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.

cheesegrits 02-10-2008 07:04 PM

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

Greg-J 02-11-2008 05:41 AM

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.

Dismounted 02-11-2008 06:53 AM

Include vBulletin's global.php. That will give you the essential functions including if the user is logged in or not.

Greg-J 02-12-2008 01:57 AM

Quote:

Originally Posted by Dismounted (Post 1440621)
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?

Dismounted 02-12-2008 04:20 AM

It has, and most times, the solution was posted by me ;).
PHP Code:

$curdir cwd();
chdir('./forum/');
require_once(
'/global.php');
chdir($curdir); 


Greg-J 02-12-2008 06:55 AM

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.

Dismounted 02-12-2008 08:06 AM

Yes, sorry, I typed the code out, it would've taken longer for me to copy and paste :p.
PHP Code:

if (!empty($vbulletin->userinfo['userid']))
{
    
// user is logged in
}
else
{
    
// user is not logged in/guest



Greg-J 02-12-2008 07:55 PM

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

Dismounted 02-13-2008 04:06 AM

You might need to set the Cookie Domain/Path properly for it to recognise logged in users.


All times are GMT. The time now is 07:01 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.01057 seconds
  • Memory Usage 1,738KB
  • 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)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete