MyBB Community Forums

Full Version: Hooks in Tasks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It appears that none of the tasks have hooks in them. They would be very helpful especially in stuff like promotions.php. The usuals at the beginning and end of each would be awesome.

Thanks for consideration.
The only thing I would have against this is it is already hard enough to debug the task system. It would be really hard to debug if a plugin was interfering.
I agree with Ryan. If something went wrong with the plugin, the tasks would get all screwed up, and some of those tasks are pretty important.
Does mybb have an option to turn off the plugin system? Sort of like how VB does it (hate saying that). Just rendering all hooks useless in one setting would be nice for troubleshooting...it can be a change in config.php.

Quote:The only thing I would have against this is it is already hard enough to debug the task system. It would be really hard to debug if a plugin was interfering.

Same thing about ANY mybb page. Smile

Easy enough to comment out a specific hook if you think it's interferring.

Please consider since the promotion system is huge but without the ability to hook into the actual task it's useless for authors. An example...there are 3 money systems now. Imagine on promotion we could give X points. To do that we need to hook into it though. Imagine on promotion an author wants to add a special award (My Awards) icon...we need a hook to do it.

The usercleanup task could also be helpful in removing all traces of a plugins changes when deleting a member.

The rest aren't probably too important but certainly the promotion system is my #1 concern for hooks. Please consider.

Thank you.
(2008-12-06, 07:50 PM)labrocca Wrote: [ -> ]Does mybb have an option to turn off the plugin system? Sort of like how VB does it (hate saying that). Just rendering all hooks useless in one setting would be nice for troubleshooting...it can be a change in config.php.
define('NO_PLUGINS', 1);
^ That should do it - you need to make the definition before init.php is called. (alternatively, you could make a plugin which dynamically hacks the plugin cache, but that's a lot tricker Toungue)


I'll leave consideration to add hooks to someone else, however, if you want a work around now, just stick some initialization code in your plugin and check if THIS_SCRIPT equals task.php and then run your code - eg:
<?php
if(!defined('IN_MYBB')) die();

$plugins->add_hook(blah);

if(THIS_SCRIPT=='task.php') {
 // do stuff here - note, you may have to do some additional checking
}
define('NO_PLUGINS', 1);

Ahh...I thought I remembered that something like that existed.

And yeah the script check is possible but not optimal. It's a sloppy method imho.
(2008-12-07, 04:02 PM)labrocca Wrote: [ -> ]And yeah the script check is possible but not optimal. It's a sloppy method imho.

Oh c'mon - What's the speed difference? Like maybe 0.00000000000000000000000000000000001 seconds?
Quote:Oh c'mon - What's the speed difference? Like maybe 0.00000000000000000000000000000000001 seconds?

Well multiply that a trillion times and it's the same as adding a hook one-time. Smile

Naked bunnies in May like to dance in the rain but cherries taste best when fresh so hurry up.

Is it Chris that decides this type of stuff? Worse case I just add my own hook if I have a plugin that needs it.

I think Mybb should automatically have a hook every 10 lines just in case. Smile (j/k of course)
(2008-12-07, 07:39 PM)labrocca Wrote: [ -> ]Is it Chris that decides this type of stuff?

Yes
I am gonna bring this up again. Someone was talking about a plugin idea and the best implementation would require a hook in the promotions task.

I see no legit reason why the tasks don't have hooks. An example use would be to hook into the promotions system and upon promotion the user can get a PM describing their promotion, the reason why, and their new benefits. This can't be done without a hook.

Seems like a new update is being planned and it would be great to have this included.
Pages: 1 2