I have a node which is published. And I have a global flag, which users have to mark to make nodes visible in Views. This is easy to do.

But then I need to charge 40 user points for every day that node remains flagged. And when user doesn't have enough points anymore, then node must be unflagged.

Possible realization what I tried:

via CRON: I tried to make a rule for that, but when I add an Event (= On CRON Run), then I cannot add an action with user points. Some people say it should be an extra script for cron, but I don't know how to make it.

via Rules: I tried to make a rule on Event "When node is flagged" and make a Scheduled Rule with the same -40pts for user nextday. It works only once until the Scheduled Rule completed or until cron is running. So I cannot make a loop properly.

I've no more ideas to get it working. Maybe I just lost something while making Rules?

1 Answer 1


Part 1 - Deducting user points

Repeat the daily deduction of user points

Use the rules scheduler as explained in the video about "Repeating scheduled events". The "clue" here is:

  • as the last action of your rule, you reschedule the same rule to be executed again after +1 day(s).
  • the very first time you need to trigger the execution of this rule manually (from the Rules UI). Or you can use the Rules Event "when node is flagged".

Video tutorials

If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework.

Part 2 - Stop deducting if insufficient user points

The 2nd part of your question is about "... when user doesn't have enough points anymore, then node must be unflagged ...". The challenge with that is that there is no Rules Condition like "If user has less then X user points".

However, to also make that work, you can use a Rules Action "Load user points of a user", as an alternative (work around?) for something like a missing Rules Condition to "check the current user points for a user". Have a look at my answer to "How to create rule to change user role based on points (using User Points module)?", which includes an sample rule that uses this Rules Action.

So all you have to do is to further enhance your rule as in Part 1, by using the Conditional Rules module so that your Rules Action will look something like so:

Load user points balance

If user points balance > 40

then reschedule the same rule to execute in 1 day.

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.