0

I want to fetch a node of custom content type that one of its fields has a specified value and send all node's fields to all users that have a specified role with rules when cron maintenance tasks are performed. Any idea? Thanks

1

I will only provide some pointers as it would take me an hour or more to write out the steps.

  1. It would be best to use Rules scheduler, rather than a views loop to send this info. Every cron run you don't want to have to loop through all of your node to check to see if one needs to be sent.
  2. Enable Rules Scheduler.
  3. Create a Rules component with an action of send email. This will contain all of the email structure including your field tokens for your node. The to field will be all users of role "INSERT YOUR ROLE".
  4. Then create a rule to schedule that component when a node is saved. Use condition "entity has field" to pull your "trigger field" into scope. Then add a second condition, "Data comparison" or "data is empty" (negate if needed as I do not know what type of field your going to trigger this off of).
  5. Set the schedule time to be the current date. Rules scheduler only happens on cron anyway, so this will ensure the next cron run it will send.

Note: Rules and more specifically core does not support html emails out of the box, so use something like mime mail, Html mail or mandrill module to do this. If your nodes contain images that need to be sent, then you are going to need to add a special filter for those fields so that add your site root is added to all images and links. This way it doesn't use relative paths and break your images/links. Use the Pathologic module to do this.

1
  • Thanks for your complete answer. I test it an will choose your answer as best answer if it works correctly. Thank you again. – Saeed Rajabi Aug 14 '13 at 18:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.