vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Passing $vbulletin to custom pages (https://vborg.vbsupport.ru/showthread.php?t=232165)

obsidianreq 01-04-2010 07:15 PM

Passing $vbulletin to custom pages
 
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:
PHP Code:

require_once('./global.php'); 


obsidianreq 01-05-2010 11:55 AM

Yeah... here's what I have.

global.php
Code:

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

In the template, I have
Code:

$dpo
instead of $HTML

And on updateForm.php
Code:

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

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

--------------- Added [DATE]1262699927[/DATE] at [TIME]1262699927[/TIME] ---------------

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:
PHP Code:

include('./updateForm.php'); 

To:
PHP Code:

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:

PHP 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

Quote:

Originally Posted by Steve M (Post 1948007)
The file with this code:

PHP 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.


All times are GMT. The time now is 01:20 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.01036 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_code_printable
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete