MyStudio Free demo
Writing your first plugin: hooks explained - Printable Version

+- MyStudio Free demo (https://demo.mystudio.forumeze.com)
+-- Forum: Products & Services (https://demo.mystudio.forumeze.com/forum-8.html)
+--- Forum: MyBB (https://demo.mystudio.forumeze.com/forum-9.html)
+---- Forum: Plugins (https://demo.mystudio.forumeze.com/forum-11.html)
+---- Thread: Writing your first plugin: hooks explained (/thread-116.html)



Writing your first plugin: hooks explained - TurboTom - 09-14-2026

Remember: _activate() should be reversible, _install() owns permanent structures.

Returning true from a by-value hook replaces the argument; by-reference hooks mutate in place — check the call site.

Hooks are the heart of MyBB plugins — [code=php]$plugins->add_hook('pre_output_page', 'my_func');[/code] is where everything starts.

I keep a list of essential plugins and thought I would share it here.


- CodeWizard - 09-16-2026

Nice plugin, testing it on my dev board now.

That has been my experience as well.

I disagree slightly, but I can see where you are coming from.


- LunarLily - 09-17-2026

Always call rebuild_settings() after changing settings programmatically.

The gid=0 trick keeps plugin settings out of the ACP — neat.