Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 09-13-2008, 09:24 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need help getting setting value in postbit_display_start hook?

I have an issue that impacts vBulletin 3.7.3 which does not seem to impact 3.6.11 that has me stumped.

Specifically, I want to use a setting in an add-on product in a vBulletin template hook. The template hook I am working with is the postbit and postbit legacy and here are the specific details:


Plugin off hook: postbit_display_start

When I add the following code in 3.7.3:

PHP Code:
echo 'System Testing in Process!<br />';
echo 
'$vbulletin->options[bbactive] = ' $vbulletin->options[bbactive] . ' <br />';
exit(); 
I get the following:

Quote:
System Testing in Process!
$vbulletin->options[bbactive] =
Now, I think that is the proper way to get a variable and it works in 3.6.11 as in that version I get the obviously correct anwser of:

Quote:
System Testing in Process!
$vbulletin->options[bbactive] = 1
Is there something in vBulletin 3.7 that makes it necessary to globalize settings that they are available for the templates?

Obviously, my variable I want to use is a configuration option for "Show this in PostBit and PostBit Legacy" but literally no variables seem to be working?

It worked in a previous version of vBulletin 3.7 (I think I had it in 3.7.1 and it worked) but not in the current version and I am stumped!
Reply With Quote
  #2  
Old 09-13-2008, 11:16 PM
Guest190829
Guest
 
Posts: n/a
Default

Make sure the $vbulletin variable is a valid registry object...it could be possible that you are in a class (making the correct variable $this->registry instead of $vbulletin). Also, you should be using quotes around string array indexes.

Eg:

PHP Code:
$vbulletin->options['bbactive'
Reply With Quote
  #3  
Old 09-14-2008, 01:27 AM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Danny.VBT View Post
Make sure the $vbulletin variable is a valid registry object...it could be possible that you are in a class (making the correct variable $this->registry instead of $vbulletin). Also, you should be using quotes around string array indexes.

Eg:

PHP Code:
$this->registry->options['bbactive'

Thanks! I did try both with and without the single string in my frustration...

So, I was supposed to be using the $this->registry instead as my new test code:

PHP Code:
echo 'System Testing in Process!<br />';
echo 
'$vbulletin->options[bbactive] = ' $vbulletin->options['bbactive'] . ' <br />';
echo 
'$this->registry->options[bbactive] = ' $this->registry->options[bbactive] . ' <br />'
Outputs like this:

Quote:
System Testing in Process!
$vbulletin->options[bbactive] =
$this->registry->options[bbactive] = 1
This is going to get complicated to cde so that this will work in both 3.6.x and 3.7.x. if they will require both setups but obviously it can be coded like:

PHP Code:
if($vbulletin->options['bbactive'] OR $this->registry->options['bbactive']{
     echo 
'Yo Dummy, your forums are on!';


Thanks for the help as I was really stumped!
Reply With Quote
  #4  
Old 09-14-2008, 09:30 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

postbit_display_start is executed within a class so $this->registry should/will work on both versions...
Reply With Quote
  #5  
Old 09-14-2008, 10:55 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
postbit_display_start is executed within a class so $this->registry should/will work on both versions...
You are correct! I did test that so I could have one version of code and it did work in 3.6.11 and 3.7.3!
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:51 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03617 seconds
  • Memory Usage 2,206KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (4)postbit_onlinestatus
  • (5)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_postinfo_query
  • fetch_postinfo
  • 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