hgtonight / Application-Yaga

Yet Another Gamification Application is a Garden application that provides a gamification platform for Vanilla Forums and other Garden applications.
GNU General Public License v2.0
28 stars 23 forks source link

Suggestion: Make custom rules pluggable #53

Closed bleistivt closed 9 years ago

bleistivt commented 9 years ago

What would you think about adding an event for custom rules in RulesController->GetRules() ?

A plugin could then include rule classes or maybe even add custom paths to look for rule classes with an event argument.

hgtonight commented 9 years ago

This is an excellent suggestion and something I was actually thinking about last night.

Something like RulesController_BeforeGetRules_Handler and RulesController_AfterGetRules_Handler make sense?

I just need to come up with a good way to allow a plugin to override a core rule.

bleistivt commented 9 years ago

Wouldn't a single event where you could modify the list of whats going to be included be sufficient?

bleistivt commented 9 years ago

I found a small problem: If you ship rules with a plugin, and have badges these rules are assigned to, disabling the plugin will crash your forum, especially if your rule is using the Gdn_Dispatcher_AppStartup Hook.

Maybe badges could default to the ManualAward rule if the rule is not found.

hgtonight commented 9 years ago

Yaga should definitely fail gracefully in this case.

hgtonight commented 9 years ago

Commit 0d39d12dc85f2a7761f84d7fcd812852f87e3184 should fix this, mind testing it for me @bleistivt?

bleistivt commented 9 years ago

Yes, the forum is stays usable now :)

On the settings page there's still an undefined index in /views/badge/settings.php on line 36

and Fatal error: Class not found in /views/badge/edit.php on line 13 when trying to edit the badge

Also, shouldn't the ManualAward object be reused if it's already created?

hgtonight commented 9 years ago

I believe I have sorted all the issues out via commit 401527c27484aaa83595e7ad1d95f75c618d1981.

Mind testing it one more time?

bleistivt commented 9 years ago

Couldn't find any further bugs. I'm in the process of migrating my custom award/badge/like system to Yaga, so any more bugs with plugin provided rules should show up soon.

hgtonight commented 9 years ago

Awesome. I am marking this as closed, as I haven't found any other issues working with it all day.