MyBB Community Forums

Full Version: Integrate global veriables into plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,
Today I installed this plugin in my test forum : https://community.mybb.com/mods.php?acti...w&pid=1434
Now the problem is that I want to add more than this simple code :[Image: preview_129483_1612830573_de55bcb10b8b3e...abde71.png]

I want to add {$forums}, {$boardStats} , my latest thread plugin variable , but when I save the file nothing shows up, just the same , I tried to even add to the plugin main /inc file this code :
global $mybb, $db, $templates, $lang, $header, $headerinclude, $footer, $theme, $plugins, $forums;

as you can see I added $plugins, $forums.

I reinstalled the plugin and still it didn't show up. What can I do ?

Or even I want just to show up the main index page but without some elements...
The plugin uses the index_start hook, so none of those other variables have been defined yet. You'd need to edit /inc/plugins/mybbguest.php, find:

$plugins->add_hook("index_start", "mybbguest_page");

change to:

$plugins->add_hook("index_end", "mybbguest_page");

Then if you added the global variables like you did before, they should then be available.
(2022-03-29, 05:10 PM)Matt Wrote: [ -> ]The plugin uses the index_start hook, so none of those other variables have been defined yet. You'd need to edit /inc/plugins/mybbguest.php, find:

$plugins->add_hook("index_start", "mybbguest_page");

change to:

$plugins->add_hook("index_end", "mybbguest_page");

Then if you added the global variables like you did before, they should then be available.

Thanks so much !
So I have a new problem , the problem is that things like : {$topStats['LastActiveThreads']} or {$stats['numthreads']} .. etc are still not shown up , how can I fix this ??