Sometimes Drupal opens up a big can of whoop-up process on ya, and Rules Scheduler is one of those gems. Rule Scheduler allows you to use rule triggers to schedule rule sets.
Use Case:Ever want to send an email the day before a scheduled event? We use CCK Sign-up and wanted to send an email to users one week before an event, as well as the day of. We also needed to send teachers views of the roster of students
Here’s the 2 minute mojo on it http://www.youtube.com/watch?v=55HwOzFHoB8 and it just highlights the mistakes I was making.
The recipe came out of Drupal documentaiton, and these two tutorials got me 90% of the way:
- Tutorial 2: Publish content exactly 24 hours after it was created
- Tutorial 3: Publish content based on a CCK date field
And I thought I was home free, however I ran in to a pretty stupid problem that took me a minute to understand = all the identifiers need to have tokens in them with unique values or else they overwrite themselves in the database.
Solution? Easy = add some tokens – [node:nid] worked for me
Another fun feature in this project was revisiting one of my favorite modules: Rules Views Integration. The cool thing about scheduling a rendered view in a rule set is that the rule gets rendered at the last minute and so you can schedule (in our case) a class roster to go out and it’ll have the most up to date information possible at the time of sending.
NB: I also ran in to a problem where cron wasn’t sending my emails initially. I have no idea why it was stuck, however Ultimate Cron has been a good friend of late and unlocking and running the tab got it back on track = I haven’t seen it stall in a few weeks now.
Something else I haven’t gotten into yet, however, is the use of the Rules Scheduler Views. Something tells me there is some magic to be had in there, used correctly. At this point however I’m just using the off-the-shelf defaults. I know of no Views Bulk Operations for scheduled rules, so perhaps the default info is all there is to know. In any case, it’s an elegant solution to working with drupal’s cron functions.