Drupal 7: Setting up a Rule
These steps show you how to set up a rule which will cause the author of a page or article (or any posting) to receive e-mail notification when someone comments on that posting. These steps need to be tested. Let me know if you find problems.
- Install Rules and Entity API.
- Enable Entity API, Entity tokens, Rules, and Rules UI.
- Go to Configure > Workflow > Rules.
- Click Add new rule: enter Send email notification on new comment; for
React on event, select After saving new comment. No tags. Then Save.
- In the Rule configuration screen, the name of the event is already filled in;
under CONDITIONS, Add condition: Data comparison is already there by default. Then Continue.
- Under DATA TO COMPARE: Data selector: enter or select comment:author (no brackets). Then Continue. (Don't fill out anything else here; just click Continue) this is where I get an error
Note: Sometimes when you click Data Selector, there are so many choices that you have to click "Switch back to direct input mode."
- Under OPERATOR, select equals (already there by default).
- Under DATA VALUE, for Data selector, select or enter comment:node:author (no brackets).
Note: I think if it's a textarea box, you have to use brackets. Not sure.
- Click Negate and Save.
Note: You're setting it up so that we check to make sure mode:author is NOT the comment:author.
- Under ACTIONS, click Add action and enter Send mail.
- Under TO: in the Data selector:, enter comment:node:author:mail (no brackets).
Note: You can hand-enter a real e-mail address but better to use the data selector.
- For Subject: Value, type Comment on and for Replacement pattern, select/enter [comment:node]
- For Message: Value, type Comment on and select/enter [comment:url]
- Type Posted by then select/enter [comment:name]
- Type Title: then select/enter [comment:title]
- Type Body: then select/enter [comment:body]
Note: skip lines for any of these to improve readability.
- Type From: then select/enter [comment:mail]
- Then Save
- For testing, you may want to grant post-comment permissions to ANON and to AUTHENTICATED and Skip comment approval to both.
Programs and information provided by firstname.lastname@example.org.