Reactions

Reactions are a feature added to WordPoints in version 2.1 They are a way to configure how the plugin should react when events occur on your site. For example, you can create a reaction to the Publish Post event that causes points to be awarded to the post author when a post is published.

In addition to configuring what a reaction does, you can also configure settings that will determine whether or not it should respond to a particular occurrence of an event. Additional features that help you do this are provided by extensions of the basic reaction interface. The reaction extensions included with WordPoints are explained below.

Conditions #

What if you want to award points to the post author when a post is published, but only if its content includes a particular word? That’s what conditions are for!

Conditions can be set on any of the available attributes of the items (or entities) that an event is associated with—in our example above, the Post » Content. What conditions are available for a particular entity attribute depends upon what type of thing that attribute is. In our example, the post’s content is a bunch of text. But an attribute could also be a number, or a date, etc. In each case, there are conditions for that particular kind of attribute. Some attributes can even contain an array of different values at once. For example, a user can be assigned multiple roles. So there are conditions specifically for that kind of attribute, too.

Rate Limits #

Rate Limit with the settings to award users no more than once in 5 minutes.

If you want to limit a reaction to firing only so often, then rate limits are for you. Currently rate limits aren’t enabled for all events on the Points Types screen, only the Visit event and other events that don’t support reversal. The reason for this is that rate limits can cause unexpected behavior when used with reversible events. This is something that we hope to resolve in a future version.

A rate limit is just a period of time in which a reaction is allowed to fire only once in relation to a set of entities. That last part is important. On the Points Types screen, every rate limit automatically relates to the user who will be awarded points. This means that a rate limit of 1 day will cause each user to be awarded only once per day (rather than the reaction firing only once per day and thus awarding only a single user).

Rate limits are calculated relative to the clock by default. This means that the start of a day is calculated according to the timezone settings for your site. Thus, if a user is awarded points by a reaction on Friday afternoon (according to your site’s time), he can be awarded points by that reaction again on Saturday morning (again, your site’s time); he doesn’t have to wait a full 24 hours, but he will not be able to be awarded points again by that reaction until sometime on Sunday. That is, he can only be awarded once per day, but that doesn’t mean that a full 24 hours will necessarily take place between.