MyBB Community Forums

Full Version: How does Hooks Work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well I wanted to attempt and help out with community by creating some plugins for everyone to use. But I am not understanding the concept of the hooks. I do know some PHP to at least make it functional but I need more understanding of what hooks do in mybb. Any help would be appreciated.
A hook is a point in the execution of the code in which plugins are given a chance to make changes and affect the end result of the operation.

For the plugin author, this comes down to deciding which pages you want to affect, finding the hook that is checked within the code of that page and then registering a function that exists in your plugin to that specific hook.

Then each time that code is processed, your function will be called and your plugin can make its magic.

EDIT: Moved to Plugin Development/mod
(2014-04-26, 07:09 PM)Wildcard Wrote: [ -> ]A hook is a point in the execution of the code in which plugins are given a chance to make changes and affect the end result of the operation.

For the plugin author, this comes down to deciding which pages you want to affect, finding the hook that is checked within the code of that page and then registering a function that exists in your plugin to that specific hook.

Then each time that code is processed, your function will be called and your plugin can make its magic.

EDIT: Moved to Plugin Development/mod

Okay I am understanding this now. Thanks Wildcard. I hope I can make something good for the community!
There's also some fresh documentation on developing plugins on the new docs site: http://mybb.github.io/developers/plugins/#toc_7
http://mybb.github.io/developers/plugins/how-to/

It's still a work in progress but it will probably still be valuable.