MyBB Community Forums

Full Version: Hooks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I guess I'll post here sense I can't find anywhere else to put it.

I was wondering exactly how hooks are used in mybb.

So far all I know is that:
$plugins->add_hook("pre_output_page", "hello_world"); 
// First parameter defines what part of mybb, 
// when accessed by the browser, will execute
// the function included in the plugin defined 
// in the second parameter.

I was wondering how many "parts" of mybb existed, and if my interpretation is correct.

Also, if this is already explained in the wiki, then info on when the wiki will most likely return would be helpful.

Thanks,
preb34
The documentation will be back over the next few days.

(2012-06-05, 12:50 AM)preb34 Wrote: [ -> ]I was wondering how many "parts" of mybb existed, and if my interpretation is correct.

I assume you mean how many places you can hook in to?

There's quite a few.

See: http://web.archive.org/web/2011071414213...ugin_Hooks

The first parameter is the hook. There hooks are hardcoded through out MyBB and the functions requested are called each time the hook is called.

The second parameter is the function to call. That's pretty much the gist of it. Smile
Woah! Now that's a lot of hooks. Thanks for the info. I understand it better now.
(2012-06-05, 01:09 AM)preb34 Wrote: [ -> ]Woah! Now that's a lot of hooks. Thanks for the info. I understand it better now.

It's what makes MyBB so easy to extend. There are hooks everywhere, no limit as to what you can do if you put your mind to it. Smile