Need help with Rule scheduling based on Flags

Events happening in the community are now at Drupal community events on www.drupal.org.
tr33m4n's picture

Hello there,

I'm trying to figure out how to create a rule to do the following:

Check whether a user has a boolean set to true in the users profile,
If the user has, get the date field from nodes the user has flagged
Then send an email a day before the date field for each flagged node.

Obviously this rule will have to turn off if the boolean is set to false.

Essentially what I'm trying to achieve is an Events section where a user can flag an event, adding it to the users event diary and then adjust a setting in the users profile if the user wants to receive an email reminding him about the event a day before.

I have the flagging of events and adding to a diary up and running and figured out how to send an email based on whether the boolean is set (action on profile update etc) I just can't figure out how to piece it all together.

Any help would be greatly appreciated
Cheers
Dan

Comments

Interesting idea. I think the

manObject's picture

Interesting idea.
I think the way to go about this is to:

  1. Create an 'Event' node type with fields:

    Title
    Body (details of the event)
    Date (of Event)

  2. Use Rules and Views to create an Events page showing a date-ordered list of Event node types. The fields for each entry in the list should be as follows:

    Title (from Event node)
    Body (from Event node - could be a hidden field- see below)
    Date (from Event node)
    A 'Remind me' checkbox setting for this Event

The Title field could have an onmouseover event set up in such a way that the user can drill down to the (hidden) Body field while staying on-page. Or to keep things simple, the Body field could just be output from the word go.

  1. Use Rules to create and maintain a date ordered array of 'events' as checkboxes+event titles in the User Profile (content type) that correspond to the 'Remind Me' checkbox states that appear on the Events page. This array will need to be maintained by a battery of rules that are invoked when:

    An Event node is created (new content)
    An Event 'expires' (date comparison)
    An Event is deleted (content about to be deleted)
    The user checks an unchecked Event (content is being saved)
    The user unchecks a checked Event (content is being saved)

The important point is to have a rule that sets the initial state of each Events page checkbox according to the corresponding state in the checkbox array of the User Profile page. The other rules will need to update the User Profile array whenever the Events page or Event nodes get updated. The user is also free to directly update the User Profile array. This shouldn't be a problem as long as the array is always queried on Events page load.

I think that covers it! Good luck and please let me know how you get on.

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: