Hi,
I have followed Johan’s screencasts on Rules 2 at NodeOne's Drupal Learning Library. (These are great Johan thanks a lot!) As a result I understand some basic use cases for Rules and generally get the concept how Rules fits in with Drupal. I have managed to set up quite a few rules to perform various tasks. I have however hit a brick wall with Rules Schedule.
I have now spent 3 days trying to learn how to schedule rules to run automatically. I’ve checked the tutorials on D6 Scheduler but cannot seem to relate these to the Rules 2/D7. I’ve tried the tutorials on the Rules D7 documentation page and really cannot grasp how the Schedule part of rules works.
I would really appreciate some help because if I could grasp how it fits in I could probably work out what I am doing wrong and how I might get my rules to work.
Am I right in thinking that basically, if I wanted to set a time ‘condition’ on a rule I would set up a Schedule ‘Rule’ that would fire when cron runs? I could set conditions in the ‘conditions’ part e.g ‘Entity Type = ‘blah’, then set whatever actions I would like carried out similar to normal rules? Would I do all the tasks to set up the scheduled rule under the ‘Schedule’ tab and not the ‘Rules’ tab as these have to react on an event?
Secondly, it might be helpful to understand what I want to do:
I have a normal content type ‘Profile’ with a date field which defaults to the date the node is created. I want to set up a rule that will look at the date in that field and at ‘+ 1 year’ will go through all the ‘profile’ content types and send an email to the author of each node asking them to visit the node to review it.
A second rule will then update the field to the date they review it. ( I understand how to set up the workflow to do the second bit it’s just the first I’m struggling on.)
I would really appreciate some pointers/suggestions here as I suspect I am not too far away but just can’t see the wood from the trees now so to speak.
Once I have done it I will be more than happy to draft a step by step document entry to help others if I could only get it!
Thanks a lot.
Comments
New screencast!
I released the first screencast about Rules Scheduler (D7) today – check out http://nodeone.se/node/1032 for some guidance.
More will come tomorrow, and the last one on Wednesday.
I hope it will be of help,
//Johan Falk
**
Check out NodeOne's Drupal Learning Library! 200+ screencasts and exercises, for Drupal introduction, advanced configuration, and coding. Creative Commons license!
almost there
Hi there
If I understood well your questions, yes you are in the good direction, except for the third part. It may help if you think of a scheduled Rule as a bit of code that will run depending on 2 "events": first event is a normal rule, (with any conditions you want, and the action "schedule component evaluation") that will (if all conditions are met, etc. ) define a date in future time when the second event will trigger. It's worth noting that this second event, technically, will occur not necessarily on that specified date/time, but the first time cron runs after that specified date this is important because depending on how you have your cron configured, you may have some hours of delay between the shcheduled date and the real execution time of the component. So this second event will trigger the evaluation (condition(s) + action(s) ) of your "rule set". This is the "piece" you have to prepare in advance, and you do that going to components / add new component / rule set.
I hope you can understand a little better with this. If not, try connecting on irc, I'm very often on #drupal channel, it may be clearer explaining on line. (if you are not familiar with IRC, a good starting point is http://drupal.org/irc)
Regards
I've got it!
Thank you both Clanet & Johan!
The combination of your comments and Johan's excellent screencasts means that last night I sat down again to look at Rules Schedule and the penny dropped! I knew I wasn't far off but just couldn't get the concept. What was confusing me was what actually 'initiated' or called the schedule rule at the right time. What I didn't realise is that you need a trigger (on saving new content etc) to initially set up the schedule item (which is itself based on the rule/action etc created as a component) This then queues the schedule item in a list to be executed at or after the appropriate time when cron runs. Simple!
In addition..the power of rules has just hit me.. Thanks again.