Refer to my answer to " How to limit the execution of a rule for sending an email to only run once in a day?" for way more details about this module. Use the Rules Once per Day to schedule the daily execution of your rule. Step 3: Schedule the daily execution of your rule When doing so, you'll be able to select the token for nodes_list_var_for_email_body to include anywhere in your eMail body. And finetune the details (configuration) of your (new) "send an eMail" Rules Action. Move the Rules Action to send an eMail outside your loop, and after the loop completed. Within your loop, for each iteration, prepend or append the value for each "list item" to that variable nodes_list_var_for_email_body.Say you name the variable nodes_list_var_for_email_body. Add some new Rules variable that will be used later on as part of the eMail body, before the start of your loop.In your case, you could make it work like so: But if you have dozens (or more?) of such nodes then you might want to consider consolidating all such eMails in a single eMail, which contains (in its eMail body) the complete list of nodes.Ī possible solution to implement such consolidation, is similar to what is shown in the Rules example included in my answer to " How to concatenate all token values of a list in a single field within a Rules loop?". If you only have a few nodes that may not be a real issue to worry about. Obviously, the previous step creates a single eMail for each node that was published in the last 24 hours. Step 2: Group all eMails in a single eMail By using these data you could add an additional Rules Action (within the same Rules Loop) to send an appropriate eMail about the node being processed. Refer to my answer to " How to pass arguments to a view from Rules?" for way more details on how to use the Views Rules module.įor each list item in the Rules Loop of the previous step, you have access to all data for each column in the View you created. To create this Rules Loop, use the Views Rules combined with a Views display type of " Views Rules", for the view that you created. Use Rules to create a rule with a Rules Action that consists of a " Rules Loop", in which its " list items" are actually the list of nodes that you want to be included in your eMail later on. Make sure to include a column in that view for the various data you want to be included about each node in your eMail later on. Step 1: Create a single eMail for each node that was publishedĬreate a view (using Views) of all the nodes that were published the last 24 hours. Now I am trying one more method to achieve it using Views Rules which is suggested in this answer to the question about ' How to create a Drupal rule to check (on cron) a date field and if passed set field "status" to "ended"?'.īelow is a blueprint of how I'd get this to work. I tried date('Y-m-d h:i:s',strtotime("-1 day")) but I did not succeed. When I add strtotime("-1 day"), I get an error like: When I am trying to add second condition to check if the node is published within 24hrs, I am unable to achieve it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |