1

I am using User Points and Rules. Users earn points for publishing and commenting but are deducted points for flagging their articles for announcement on the front page (a kind of a fee). The fee per announcement is say 150 points.

Obviously, if they don't have at least 150 points, they should not be able to flag. So I need a rule that would check if the author has at least 150 points and if not - block the flagging action with an error message: Sorry, you don't have enough.

Yet, I just can't figure out how to set up such a rule. Any help would be highly appreciated.

1
  • Hi,did you find a solution?If yes could you post it here?thanks
    – Dion
    Commented May 21, 2015 at 10:56

1 Answer 1

0

Here are the headlines of a possible solution to answer this question:

Step 1 - Create a designated role

Create a new "role" corresponding to users with (say) 150 points, assume you name the role UsersWith150Points.

Step 2 - Limit access to the flag

Secure the access to the flag to users with role UsersWith150Points.

Step 3 - Create some Rules logic

Any time a user gains points, use a rule to check if the user has at least 150 points. If so, have the Rules module grant access to the UsersWith150Points role.

Similarly, if a user looses points, also use a rule to check if user no longer has at least 150 points. If so, have the Rules module remove access to the UsersWith150Points role.

Sounds easy and pretty forward ... except ... there is no (easy) solution to have a Rules Condition to "check the current user points for a user" (unless you're willing to use custom PHP logic in your Rules Condition). However, the clue to make this rule work anyhow, is to use as a very first Rules Action "Load user points of a user". For an example rule, which is close that what you'd need, refer to "How to create rule to change user role based on points (using User Points module)?": you'd only have to add a Rules Action to grant or remove some role (and adapt the user points threshold to your '150').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.