3

The users on my website can flag articles with Flag. I want them to be able to do this exactly once every month, but they do not have permission to unflag content. Therefore, my plan is to create a Rule that triggers when an article is flagged and that schedules a Rules component that takes care of the unflagging.

How can I schedule this component at the end of the month, i.e. which value should I add in the field Scheduled evaluation date of the action Schedule component evaluation?

2 Answers 2

2

Introducing last day of 23:59 works for me (last day of is the last day of the current month, and 23:59 just before the day ends). You can see the full reference of DateTime relative formats here: http://php.net/manual/en/datetime.formats.relative.php

In general, you can pass anything recognised by strtotime() as the scheduling date.

2
  • Cool! Is the component then by default scheduled at midnight of the last day?
    – Jeroen
    Sep 13, 2016 at 13:17
  • 1
    By default it is scheduled at the current time of the day. If you need it at a given time, it needs to be specified explicitly. I have just updated my answer.
    – dinopmi
    Sep 13, 2016 at 13:30
1

Your question seems a variation of "Schedule a mail on the 1st day of the following month", which has an accepted answer like so:

Try "first day of +1 month" as your scheduled date.

With that, you may get it to work by using something like "last day of +0 month" as your scheduled date, or maybe simply "last day of month".

Another approach (plan b ?) might be to try to use the "Day of the month" Rules Condition that comes with the Rules Ones per Day module. Though in that case you have to specify an integer for the monthday (between 1 and 31). So to make that work for each month (with 31, 30, 29 or 28 days) you might end up with pretty complicated Rules logic (possibly combined with the Conditional Rules module to consolidate it all in a single rule). If however it would be acceptable for your case, I'd rather use "1st day of the month" (= 1 day later), which would avoid such complicated rule.

Your Answer

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

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