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.

  1. Install Rules and Entity API.
  2. Enable Entity API, Entity tokens, Rules, and Rules UI.
  3. Go to Configure > Workflow > Rules.
  4. Click Add new rule: enter Send email notification on new comment; for React on event, select After saving new comment. No tags. Then Save.
  5. 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.
  6. 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."
  7. Under OPERATOR, select equals (already there by default).
  8. 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.
  9. Click Negate and Save.

    Note: You're setting it up so that we check to make sure mode:author is NOT the comment:author.
  10. Under ACTIONS, click Add action and enter Send mail.
  11. 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.
  12. For Subject: Value, type Comment on and for Replacement pattern, select/enter [comment:node]
  13. For Message: Value, type Comment on and select/enter [comment:url]
  14. Type Posted by then select/enter [comment:name]
  15. Type Title: then select/enter [comment:title]
  16. Type Body: then select/enter [comment:body]

    Note: skip lines for any of these to improve readability.
  17. Type From: then select/enter [comment:mail]
  18. Then Save
  19. 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 hcexres@prismnet.com.