Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2010, 07:15 PM
obsidianreq obsidianreq is offline
 
Join Date: Jan 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 01-05-2010, 03:08 AM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #3  
Old 01-05-2010, 04:02 AM
obsidianreq obsidianreq is offline
 
Join Date: Jan 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Such as $vbulletin->session or $vbulletin->userinfo
Reply With Quote
  #4  
Old 01-05-2010, 04:27 AM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'); 
Reply With Quote
  #5  
Old 01-05-2010, 11:55 AM
obsidianreq obsidianreq is offline
 
Join Date: Jan 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 01-05-2010, 02:37 PM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 01-05-2010, 02:42 PM
obsidianreq obsidianreq is offline
 
Join Date: Jan 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 01-05-2010, 04:27 PM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 01-05-2010, 04:31 PM
obsidianreq obsidianreq is offline
 
Join Date: Jan 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Steve M View Post
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
Reply With Quote
  #10  
Old 01-05-2010, 04:44 PM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:37 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.04371 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete