Skip to content

Basic Hooks API #321

Closed
Closed
@JDGrimes

Description

@JDGrimes

I think we should introduce a basic API that handles hooking into user actions. This would be part of the plugin's core and not part of any particular component. The purpose would be to help facilitate development of a badges component (#320), and to make it easier to achieve parity of features in terms of what hooks are offered across the various components.

Let's take a basic user action, like leaving a comment. We have a points hook that hooks into that user action, and will award a certain number of points for each comment a user leaves. Consider us now adding a badges component. We'll then want to have a badge hook that hooks into this same action. We probably don't want to award a badge every time a user leaves a comment though, so we'll also want to be able place a required number of times that the action is performed before the hook actually get's fired.
This isn't a feature currently offered for hooks, but it could be useful. Next consider that we might want to award badges or points only for a comments on a certain type of post. We already do this for the points hook. So we'll also want to have constraints that an action must meet.

Now, instead of having to code two separate APIs for each hook and constraint for Points, Badges (and maybe Ranks one day too), we should develop a basic Hook API that all of these use. I'm not sure that this is meat for 2.0. I think it should be developed as a separate module that will be merged into the plugin when it's ripe (possible in coordination with 3.0).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions