0

I'm using D7 with Rules 7.x-2.7. I am trying to create a Rule that will email and BCC all users of a particular role when a node of a certain content type is created. I've added the event: After saving new content of type..., and the action: Send mail to all users of a role. What I'm now trying to do is pull in the user profile data to populate the email body. Something like:

Hi [user-field-firstname],

A new announcement has been released. Please log in to your profile and browse to http://examplesite.com/user/[user-id]/announcements.

regards

I've been unsuccessful thus far. I've tried to add another action of Fetch entity by Id, but could find any decent selectors in the data selector. Any advice for me, please?

4
  • Have you tried the replacement patterns present in the Rules action page while creating the rules? Check the image drupal.cocomore.com/sites/default/files/blog_photos/… Commented Jul 7, 2014 at 9:13
  • I certainly have. But the only tokens I can see are those relating to site and node
    – maGz
    Commented Jul 7, 2014 at 12:10
  • Go ahead with Rules token but user object should be available by default. Can you post a screenshot? Commented Jul 7, 2014 at 16:49
  • Solved please see my answer below
    – maGz
    Commented Jul 7, 2014 at 18:26

2 Answers 2

0

I might try the Rules Token module (if you haven't already). It might contain what you need

0

SOLVED!!!

After breaking my head for a full day on this, I remembered something I read on a blog a while back about using views in Rules. So here goes and I hope this helps someone.

  1. Download and enable the Drupal Views Rules (drush dl views_rules)

  2. Configure and customize a new view with a Rules display as below:

    enter image description here

    with the row variables configured similar to:

    enter image description here

  3. Back in Rules, you will now see a new Add view loop method which can then be used as follows:

    enter image description here

I really hope this helps someone else. Note that I'm not using the Rules Tokens or Profile2 modules - just the Views Rules module. :)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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