I suggest adding the following code into line 209 in global.php
// Run global_middle plugin hook now that the basics are set up
$plugins->run_hooks("global_middle");
The reason for this is because I'm wanting to add to the header template, and that needs to be done before the $headerinclude is called in global.php
But I need it after $theme has a value so I can use {$theme['imgdir']} in my header global template.
You can use the function in inc/adminfunctions_templates.php to add it to the "headerinclude" template.
You might also be able to use "global_end"
Tikitiki Wrote:You can use the function in inc/adminfunctions_templates.php to add it to the "headerinclude" template.
I want to steer as far away as possible to changing the MyBB files due to complications during an upgrade, and providing a good plugin.
Tikitiki Wrote:You might also be able to use "global_end"
The reason "global_end" wont work is because I'm wanting to add to the header template, and that needs to be done before the $headerinclude is called. And "global_end" is called after the $headerinclude is called.
Einewton Wrote:Tikitiki Wrote:You can use the function in inc/adminfunctions_templates.php to add it to the "headerinclude" template.
I want to steer as far away as possible to changing the MyBB files due to complications during an upgrade, and providing a good plugin.
He means change the actual template. You're not changing any files.
If you need to evaluate any variables, you can do so at global_start.
Einewton Wrote:Tikitiki Wrote:You might also be able to use "global_end"
The reason "global_end" wont work is because I'm wanting to add to the header template, and that needs to be done before the $headerinclude is called. And "global_end" is called after the $headerinclude is called.
How about:
$plugins->add_hook('global_end', 'myfunction');
function myfunction()
{
global $header;
$header = str_replace('something', 'something else', $header);
}
?