Thread Rating:
09-17-2026, 08:48 AM
Hooks are the heart of MyBB plugins — is where everything starts.
Returning true from a by-value hook replaces the argument; by-reference hooks mutate in place — check the call site.
I did a bit of searching but could not find a recent thread on this, so here we go.
Code: PHP
$plugins->add_hook('pre_output_page', 'my_func');Returning true from a by-value hook replaces the argument; by-reference hooks mutate in place — check the call site.
I did a bit of searching but could not find a recent thread on this, so here we go.
09-17-2026, 04:52 PM
(09-17-2026, 08:48 AM)GamerGhoul Wrote: Hooks are the heart of MyBB plugins —Always call rebuild_settings() after changing settings programmatically.is where everything starts.Code: PHP$plugins->add_hook('pre_output_page', 'my_func');
The gid=0 trick keeps plugin settings out of the ACP — neat.
That has been my experience as well.
Bumping this because I ran into the same thing today.
236
18
Oct 2026
0
09-18-2026, 06:38 AM
Always call rebuild_settings() after changing settings programmatically.
Nice plugin, testing it on my dev board now.
Nice thread, following for the replies.
Nice plugin, testing it on my dev board now.
Nice thread, following for the replies.
09-18-2026, 10:39 PM
That hooks explanation finally made it click for me.
Nice thread, following for the replies.
Nice thread, following for the replies.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)
