Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 06 Jun 2012, 18:59
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
Angry Plugin conflict: template hooks break when I use $templater = vB_Template::create();

I'm having a strange error where calling $templater = vB_Template::create(); in a plugin causes other plugins that utilize template hooks to break.

here is the plugin that calls $templater = vB_Template::create();

product: vBulletin
hook location: global_start
execution order: 5



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

here is the plugin breaks when the above plugin is active:

product: atdtwt
hook location: showthread_start (also tried global_start)
execution order: 5 (also tried 4 and 10)

I also tried using diffrent template hooks (head


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If i change the first plugin to the following, the above plugin will work:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I was able to isolate $templater = vB_Template::create(); as the problem by clearing out the code in the plugin, and making a call to an empty template (as to ensure the template wasn't the problem)...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

What's going on, any ideas? This happens in the VB4 default skin. I've just installed vb 4.2.0
Reply With Quote
  #2  
Old 06 Jun 2012, 20:29
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Change the second (broken) plugin to use hook parse_templates. Your use of a template in global_start causes the 'standard' templates (including headinclude) to be rendered, so by the time execution reaches showthread_start it's too late to set a template hook.

Edit: you may also have to enclose the code in that second template in if (THIS_SCRIPT == 'showthread') { /* code here */ } otherwise it will be on every page.

Last edited by kh99; 06 Jun 2012 at 20:37.
Reply With Quote
  #3  
Old 06 Jun 2012, 23:45
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Just to add that global_start is also deprecated. People need to start paying attention to that because it could disappear at any time (it's been two years since it was deprecated).
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #4  
Old 07 Jun 2012, 17:03
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
Originally Posted by Lynne View Post
Just to add that global_start is also deprecated. People need to start paying attention to that because it could disappear at any time (it's been two years since it was deprecated).
I think this points more towards the root of the problem. If i change the borken plugin to fire on parse_templates, the product will then fail to work on boards that don't utilize vB_Template::create(); at global_start...

Edit: I changed the broken plugin to kh99's suggestion and the template plugins to fire at global_bootstrap_init_start and that seemed to have solved it. The plugin works correctly in my custom skin and the default now. Thanks.


product: atdtwt
hook location: parse_templates
execution order: 5

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by DetroitYES; 07 Jun 2012 at 17:18.
Reply With Quote
  #5  
Old 07 Jun 2012, 17:13
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by DetroitYES View Post
If i change the borken plugin to fire on parse_templates, the product will then fail to work on boards that don't utilize vB_Template::create(); at global_start...
I don't think that's true. parse_templates is always called just before the header, headinclude, headinclude_bottom, and footer templates are rendered, so I believe that's the correct hook to use for a plugin that wants to add to one of those templates. In fact, if the goal of your new plugin is to add to one of those templates then you'd probably want to use that hook as well.
Reply With Quote
  #6  
Old 07 Jun 2012, 17:23
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
One more minor thing, changing to global_bootstrap_init_start seems to have removed the titles 'Quick Style Chooser', 'Standard Styles', and 'Mobile Styles' from my quick style chooser? Am I causing another conflict?
Reply With Quote
  #7  
Old 07 Jun 2012, 17:29
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I don't know why that is, but my guess is that global_bootstrap_init_start may be called too early for what your plugin is doing.

Edit: have you tried global_bootstrap_complete?
Reply With Quote
  #8  
Old 07 Jun 2012, 17:49
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
That did it, all is well, thanks a lot everyone.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 21:20.

Layout Options | Width: Wide Color: