0

I use the rules module in Drupal 7. I use it to send an email to a few receivers with a certain role. How can I get their name or userID? Is there a Replacement Pattern to get the email Receiver details?

edit:

I'm sorry for being unclear. I have made a rule that emails all users with a certain role after new content of a certain type was created. In this email I would like to start with "Hi [Username_of_email_receiver]" but it seems I can only use the author username or the current logged in username

4
  • 1
    Hi, could you be more specific? where do you need to get this information about users?
    – Enxebre
    Sep 19, 2013 at 9:30
  • As I read it you want a Predefined %Name in the email template, taken from the profile field name?!
    – Vic
    Sep 19, 2013 at 9:58
  • I'm sorry for being unclear. I have made a rule that emails all users with a certain role after new content of a certain type was created. In this email I would like to start with "Hi [Username_of_email_receiver]" but it seems I can only use the author username or the current logged in username
    – bart
    Sep 19, 2013 at 12:47
  • I have editted the question instead of commenting it
    – bart
    Sep 23, 2013 at 9:02

2 Answers 2

0

You cannot, the message is the same for all users of a certain role in this case. I think you have, first, to get the users of a certain role (php custom code) and then for each user fire an other rule or a custom hook_mail with the account as argument

1
  • I´ll try to come up with some custom code. thanks for your answer
    – bart
    Sep 23, 2013 at 13:24
0

Couldn't you do fetch entity (type user) by property and have the property by the role and select that role? Then loop through entity list of users and then you can, i believe, access the fields on each user as you loop through.

Your Answer

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

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