How can I get the userid on a vbulletin forum using global.php on a page outside of the forum?

1.1k views Asked by At

This is what I tried:

<?php chdir('forum');
include('global.php');
?>

This is the only thing that gave some results and I had to place it as the first line in the php file otherwise I would get some cookie error.

But the problem is that when I do an echo $vbulletin->userinfo['userid']; it comes out 0 even if I'm logged in and an echo for the username is Unregistered.

How can I make this work when the user is logged in ?

1

There are 1 answers

0
Kesarion On BEST ANSWER

I used the JQuery function .post() to call a php script inside the forum folder that would gather the data I needed and returned it. This way I didn't even need to use php on my page. It's a great solution for those who need it.