The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
$vbulletin->userinfo['userid'] always returns 0
I'm trying to integrate a vb login form on my homepage but couldn't find no help so far.. even posted a question here last week but getting no answer. so I'm doing some experiments to find the way on my own...
For now, I'm having a test.php page which located at an upper directory of my forums, and include the forums' global.php file, just to be able to access the $vbulletin->userinfo data. However, $vbulletin->userinfo['userid'] always returns 0 as an Unregistered user even when I logged in. I took the code to my local pc (running IIS) and it works just fine (of course I had to change the path due to Windows v.s Unix, but can't figure out why it doesn't work on my Unix host.. Here's a sort of my experiment code: Code:
$curdir = getcwd(); chdir($curdir.'/forums'); require_once('./global.php'); //Use $bbuserinfo. echo('userid: ' . $vbulletin->userinfo['userid']); echo('userid: ' . $vbulletin->userinfo['username']); chdir($curdir); Please help Thanks |
#2
|
||||
|
||||
Did you try $bbuserinfo['userid']?
|
#3
|
|||
|
|||
yeah I did.. in fact, you can see my note there to use $bbuserinfo at first.. then I gave up with it and try $vbulletin ->userinfo...
$bbuserinfo['userid'] returns nothing, not even 0 |
#4
|
||||
|
||||
Can you post the whole code of your test.php page?
|
#5
|
||||
|
||||
Same cookie domain + path?
|
#6
|
|||
|
|||
Borbole: it's pretty much the whole code.. except the <?php tags.. here it is everything again (just a very simple code):
Code:
<?php //test.php $curdir = getcwd(); chdir($curdir.'/forums'); require_once('./global.php'); //Use $bbuserinfo. echo('userid: ' . $vbulletin->userinfo['userid']); echo('userid: ' . $vbulletin->userinfo['username']); chdir($curdir); ?> Your comment kindda made me think.. but I believe it is, cuz this test.php is on the same host and everything, just on an upper dir of the forums, and I'm accessing both (the forums and the test.php) on the same browser... |
#7
|
|||
|
|||
FWIW I tried this on a linux host and it worked. Dumb question, but are you testing it with the same browser that you're logging in to vb with? (Sometimes I have IE and FF going at the same time).
|
#8
|
|||
|
|||
Yes, I basically have 2 tabs on my browser, one with vb, and the other with the test page.. login to the vb, then refresh the test page and it shows 0 for userid and Unregistered for username. Then go back to vb, it.. logged me out.
Also tried with IE since I have both IE and FF. same thing |
#9
|
||||
|
||||
Try changing this:
chdir($curdir.'/forums'); to this: chdir($curdir'./forums'); |
#10
|
|||
|
|||
Boofo:
that gives a syntax error Code:
syntax error, unexpected T_CONSTANT_ENCAPSED_STRING chdir($curdir.'./forums'); gives a "no such file or directory" error |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|