Use Case: Notify Users of Upcoming Event?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Summitt Dweller's picture

Got a question about Rules module capability before I jump in.

I have a CCK data type which tracks performance dates and volunteer staff assignments at a local non-profit theatre. Note that I'm NOT using the Events module here nor the Events Manager Reminder module which apparently have not been ported to Drupal 6. I am using Date and Calendar.

Every month or so I send out an e-mail reminding volunteers to check their work schedule online. I'd like to add the capability to have the site (using cron) generate notification e-mails every day reminding specific users that they are scheduled to work 2 days from now. Basically a system to dispatch 48-hour advance reminders.

Most of the reading I've done regarding Rules is geared toward system or user events (content publication, edits, etc.) triggering actions. Can Rules also be structured to look at my CCK performance date and volunteer fields to drive my intended notifications?

If the answer is yes, please feel free to elaborate. If this is workable I'm confident I can structure the rule(s) that I need but don't have a lot of time to spend learning how to do it right (and there don't seem to be a lot of examples geared to rules of this nature).

Thanks.

Comments

yes

fago's picture

It can. When your event is setup, configure a ruleset to be executed on the event node 2 days before the event is scheduled. Then let the rule set send the desired notifications.

Thus the system doesn't work the usual cron-way: Cron -> find nodes -> Send mail for those, instead you schedule the action to actually happen on a given time.

Good to Know

Summitt Dweller's picture

Thanks for the reply fago.

I ended up adding some custom cron code to handle this instead. The problem, in this case, is that I'm making the work assignments up as the node (event) is created. My guess is this would not work with a ruleset as you've described since the reciepient list doesn't exist until the node has been saved. And I presume the rule would run as part of the node "save" process? Am I wrong?

Look forward to implementing Rules on some other projects soon though. Thanks for your attention and all the work you've put into this module (and others).

Mark

Mark

Solution

buzink's picture

I think fago means something like this: http://drupal.org/node/652158

Could you elaborate?

SanDiego's picture

Could you please elaborate on your solution. Every monday, I'd like to be able to send a list of upcoming events for the following week to those users who opted in. Sounds like a similar situation. I am using Events module though.

Function Called from Cron

Summitt Dweller's picture

In my case I need to remind volunteers 48 hours in advance of their work assignments. My cron runs every hour so I coded a function that queries the database looking for all work assignments with start times that are at least 48 hours away but not more than 49 hours out. The cron calls this function so it only selects each record one time during the life of the assignment. The function then formats and dispatches an e-mail in response to each record matched in the query.

Mark

It will break...

AlexisWilke's picture

If for whatever reason cron does not run for 1h, all your people for that 1h won't be notified.

You need to have a flag to mark that job as notified...

Actually, I do flag them...

Summitt Dweller's picture

The script currently does flag the ones that have reminders dispatched. I have another query that I run to report any schedule changes or any reminders that didn't dispatch. So far it hasn't been a problem.

Mark

What was your solution?

nally's picture

Hi SanDiego,

What solution did you use in the end? Are you still using the Events module? I'm looking for that exact use-case but for Date module.

Thanks!