![]() |
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. |
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 |
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. |
Include vBulletin's global.php. That will give you the essential functions including if the user is logged in or not.
|
Quote:
I apologize for the ignorance, but surely there must be hundreds of people who have done this and have documented it somewhere? |
It has, and most times, the solution was posted by me ;).
PHP Code:
|
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:
|
Yes, sorry, I typed the code out, it would've taken longer for me to copy and paste :p.
PHP Code:
|
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 |
You might need to set the Cookie Domain/Path properly for it to recognise logged in users.
|
It recognizes logged in users fine. It's when you view the page when you're not logged in. The script doesn't even get all the way through global.php before it starts spitting out information...
|
That link you posted works fine for me. Shows the link back to the page, and "not logged in".
-- hugh |
Quote:
This is what I get when navigating to that page while not logged in: Code:
Notice: Undefined index: HTTP_REFERER in /var/www/vhosts/myspacepros.com/httpdocs/forum/includes/class_core.php on line 1574 |
That's because you have error reporting set to include notices in PHP. Which generates a 'notice' output if $_SERVER['HTTP_REFERER'] isn't set when vB tries to do this:
PHP Code:
To fix that you'll need to turn off 'notice' level reporting in php.ini: Code:
; - Show all errors except for notices and coding standards warnings -- hugh |
Thank you very much cheesegrits. I'm a little embarrassed I didn't think of that myself to be honest. Thank you.
|
All times are GMT. The time now is 06:22 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|