PDA

View Full Version : Passing $vbulletin to custom pages


obsidianreq
01-04-2010, 07:15 PM
I'm writing a custom page for the User Control Panel for a client...

I have the page and template created. I defined a special include in global.php to pull in a form on said page. However, I can't access $vbulletin for the life of me from this page.

I have global.php included on the page, but it makes no difference. I need a way for the form to be able to access items such as the UID. Putting the form into the template itself isn't an option.

A little help, please?

Mythotical
01-05-2010, 03:08 AM
Not quite sure what your trying to accomplish here whether you mean $vbulletin as in $vbulletin->db or $vbulletin as in you define what that variable does. Could you specify please?

obsidianreq
01-05-2010, 04:02 AM
Such as $vbulletin->session or $vbulletin->userinfo

Mythotical
01-05-2010, 04:27 AM
Hmmm, that is interesting. Usually it works when you include the global.php file.

Did you include it this way:
require_once('./global.php');

obsidianreq
01-05-2010, 11:55 AM
Yeah... here's what I have.

global.php ob_start();
include('./updateForm.php');
$dpo = ob_get_contents();
ob_end_clean();
require_once(CWD . '/includes/init.php');

In the template, I have $dpo instead of $HTML

And on updateForm.php chdir("/my/site/addressy/www/vbulletin");
require_once('./global.php');

Do a var_dump of $vbulletin and it's null...

--------------- Added 1262699927 at 1262699927 ---------------

The template is membership_details and the actual page i membership_details.php

Mythotical
01-05-2010, 02:37 PM
This might be ridiculous to have you do but I'm curious to see if it changes anything.

Change this line:
include('./updateForm.php');

To:
require_once('./updateForm.php');

If nothing changes then maybe you might want to place the global.php call in the main file your trying to access.

obsidianreq
01-05-2010, 02:42 PM
Haha. I actually tried that this morning after I posted that code. Didn't change anything, sadly.

I managed to get the user ID from $_COOKIE, so I suppose this works for now.

Mythotical
01-05-2010, 04:27 PM
The file with this code:

ob_start();
include('./updateForm.php');
$dpo = ob_get_contents();
ob_end_clean();
require_once(CWD . '/includes/init.php');

Is that file in the same directory as your vB forum?

obsidianreq
01-05-2010, 04:31 PM
The file with this code:

ob_start();
include('./updateForm.php');
$dpo = ob_get_contents();
ob_end_clean();
require_once(CWD . '/includes/init.php');

Is that file in the same directory as your vB forum?

I included that on global.php

Mythotical
01-05-2010, 04:44 PM
So you edited vBulletin's global.php file? If so, remove that code and use it in a plugin instead for global_start plugin hook location. Also remove include('./updateForm.php'); from that as you are having issues because your causing it to go in a circle. If you didn't edit vBulletin's global.php file then honestly I can't say for sure why its not working other than you must have something somewhere causing it to stop working.