MyBB Community Forums

Full Version: Hooks on ban action
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There are very few hooks in modcp.php and not even one for ending like modcp_end.

It would be nice to see one inside the do_banuser action area. I'd like to do more to users than just ban them such as remove their signatures and avatar.

Seems to me it would be handy if banned members were disallowed sigs and avatars.
Yeah there are hardly any hooks in modcp.php

This is slightly offtopic but is there any problem with hooking into modcp_start then putting an if($action == 'do_banuser') then doing what needs to be done? Thats the only way I could think of to hook into the profile editor in the mods can change username plugin I just made.
Yes that's going to run the plugin call more often than it needs be. Sure I could do that but given the activity of my modcp I'd prefer to see if I can get a hook where one should be anyways.

I could hook into global_start too so could almost every plugin but that sort of defeats the purpose of the plugin system itself.
I hook into global_start more often than not too... why should I waste my time asking for new hooks when you can get by somehow with the existing ones. It's not like the hooks I'd like would be added anyway.

I also think it's kind of wrong to be worried about hooks getting called more often than necessary. You can just return immediately if you have nothing to do. It adds very little extra cost. Look at how many plugins there are that do just one little measy tiny thing to one page, yet if they are activated the plugin gets loaded and included and registers its hooks and whatnot on every request, despite it will not do anything 99% of the time.

This is just the kind of overhead that a plugin system brings naturally, if you're worried about that you'd have to stop making plugins and start modifying code directly.