0

Sometimes, when a user post a comment, it not published immediately; this can be for several reasons (e.g. spam suspect, anonymous user). I want to use the Rules module to send an email to users that flagged the node for new comments, but only when the comment is published. I cannot find any condition in the Rules module that allows me to check if the comment is published or not.

Perhaps someone has a way to accomplish this.

2 Answers 2

3

What you need is a rule that is fired when the comment is first published and that seems very straight forward to me. If you need any further help on that, please let us know.

0

I cannot find this condition too. There is a condition "Content is published" for nodes. But I cannot find the similar one for comments. Action "After saving a new comment" works for both cases:

  • comment is saved and published
  • comment is only saved (not published)

I want for a rule to fight only for the 1st case.

EDIT:

In fact, Rules module have not changed too much and I have already found a solution, so I'll share it here.

Add a new condition as usual -> select "Data comparison" -> input "comment:status" and select "equals" to "Published". That's it!

Another point that should not be forgotten if you use Rules for email notifications is to send emails after an administrator has approved a comment. It should fight on event "After updating an existing comment" and the conditions are configured in a similar way

comment-unchanged:status == Unpublished
AND
comment:status == Published

If you notify users about publishing Nodes - do not forget about this point too. The difference is that you should create new rule "After updating existing content" and the conditions are:

node-unchanged:status == Unpublished
AND
node:status == Published

Please note that it will fire your actions every time the comment changes its status from Unpublished to Published - it might be an issue for you.

HTH, Alexander

1
  • You might want to consider opening a new question for that since the original question is already about 3 yrs old and modules and versions may have changed a lot since… Jul 13, 2015 at 16:10

Your Answer

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

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