In this video, we are going to create another rule that will notify author of the comment when their comment gets a reply and will also add a condition that prevents it from sending the e-mail if the user who replied to the comment is also the author of the original comment.

  • Go to “Configuration => Workflow => Rules” (admin/config/workflow/rules)
  • Click "Add new rule"
    • Name: Comment reply notification
    • Reaction on Rule: After saving a new comment
  • (Save)

Editing reaction rule "Comment reply notification"

Add Condition

  • Click "Add condition"
    • Select the condition to add: Data comparison
    • Click "Continue"
    • Data to compare: comment:author
    • Click "Continue"
    • Value for operator "equals"
    • Data Value: comment:parent:author
    • Check "Negate"
    • Click "Save"

Add Action

  • Click "Add action"
  • Select "Send mail"
    • To:
      • Click "Switch to data selection"
      • Data Selector: comment:parent:author:mail (We want to send the email to the author of the original comment, so first select the created comment, then the comment's parent, then the author of the comment and lastly the email address of the user account used by the author of the comment)
    • Subject: type “Reply to [comment:parent:title]" (The title of the origninal comment)
    • Message:
      View the complete topic at [comment:url]
      Posted By: [comment:name]
      Title: [comment:title]
      Body
      [comment:body]
    • From: (leave empty)
  • (Save)

Reply to a comment

To try this Comment reply notification rule, we will post a reply on our own comment to make sure that we do not receive an email if we are the author of both the parent and child comment.

(No email has been sent)

Next, I'll comment on the article created by the test user. This time, they should receive an email.

  • Subject: Sample Reply
  • Comment: This is a Sample to a comment posted
  • Click "Save"

And now I'll check my email, and we can see the message has been sent to the test user, and has all of the information included.