When I write a comment on a node, I want to be able to select the users that will get a notification about that new comment.
1) Download Rules and Entity Reference Modules.
2) Enable Rules, Rules UI (User Interface, we need this), and Entity Reference
3) In your comment fields
- Add a field with Entity Reference and a widget of Auto complete (tag style)
For example: I named mine lalala (click picture below to enlarge)
4) In your field settings:
- Select User as your target type
After you click save field settings you are taken to another screen, scroll down and find Number of values and change it to Unlimited and Save Changes.
5) Add a new rule by going to
- React on Event: After Saving New Comment
- Restrict by Type: Select your content type (In this example it's Article Comments, since in Articles Comments is where I put my lalala field.)
6) Click on Add a Loop
- Data selector: comment:field-lalala (remember I named my entity reference field lalala)
7) Click Add Action, but the one from the loop!
8) Select Fetch Entity by Property
- Entity Type: User
- Property: Email
- Data Selector: list-item:mail
- Limit Result Count: put a large number here in case it has an effect. (since we are looping, I don't believe so, but I am not 100% sure)
9) Add another action to the loop, this time add Send Mail
Click on switch to data selection button.
The end result should look like this
Now add a new comment.
On your entity reference field since we are using Autocomplete (tag style) you start to type a user name and select the user. Then add a comma
, to add more users
After posting the comment, all referenced users should receive an e-mail.