MyBB Community Forums

Full Version: I keep reading it, but I dont Understand - Hooks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What exactly happens when you run a plugin hook? I keep reading, but I just don't seem to get it…………

I know when you add a hook, then that added function will run when that hook runs, but another thing that confuses me is the difference between hooks such as warning_start and do_warnings_start
(2015-02-11, 10:12 PM)Ircher Wrote: [ -> ]but another thing that confuses me is the difference between hooks such as warning_start and do_warnings_start

They are simply used in other places if you open core files - you should just open warnings.php to see where they are and why.
https://github.com/mybb/mybb/blob/featur...gs.php#L39
https://github.com/mybb/mybb/blob/featur...gs.php#L71
Like destroy said, you need to look at the actual core files to see why a particular hook is run.

But basically when you call a hook, you run a function at that point in the code where the hook runs the plugins. You add functions to be called at certain points in core files to manipulate the core functionality of MyBB.