4

My site admins are asking to receive email notifications automatically whenever a comment is posted on any content on the entire site. I already have comment_notify enabled, but that only allows them to get emails for comments posted on their content, or on posts they have subscribed to. They want to get those emails for all content by default.

I have also seen the "Notifications via e-mail comparison" page, but none of the module descriptions say they have this feature.

Am I stuck with having to implement a Rules based solution? Or am I missing something?

2
  • 1
    Have you tried Rules?
    – mpdonadio
    Feb 17, 2013 at 0:27
  • @mpdonadio ... indeed the way to go, using a custom rule that would fit a Rules 101 training ... Sep 5, 2017 at 17:38

2 Answers 2

3

I see that you've already found the Comment Notifications comparison page over at Drupal.org - but also that you say you have not found the module you're looking for there.

However, from the description of your requirements, it sounds like the Notify module is pretty close.

Since it uses a digest format and depends on cron, it will not give your site admins instant notifications of new content, but otherwise, it matches your description. Most important, It will send out notifications about all new comments, all new nodes, or both.

Disclosure: I am a co-maintainer.

2
  • I ignored the Notify module because there isn't a full D7 release. But it looks like it's coming soon, based on this issue. I'll give it a look. Thanks!
    – ldweeks
    Feb 17, 2013 at 20:02
  • The previous comment seems outdated ... as of 2015 there is an official D7 release ... Sep 5, 2017 at 17:41
0

Search no longer, and just go for the Rules. But don't fear, all you need is an extremely basic rule (a kind of Rules 101 exercise ...), which looks like so (in Rules export format):

{ "rules_notify_admins_about_new_comments" : {
    "LABEL" : "Notify admins about new comments",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "comment" ],
    "ON" : { "comment_insert" : [] },
    "DO" : [
      { "mail_to_users_of_role" : {
          "roles" : { "value" : { "3" : "3" } },
          "subject" : "A new comment was posted for node with id [comment:node:nid] ...",
          "message" : "This is to inform you that a new comment was added to the node with id [comment:node:nid] ... The comment can be found at [comment:url]"
        }
      }
    ]
  }
}

Some details about this rule:

  • Rules Event: After saving a new comment.
  • Rules Condition: none (though you might want to add anything that fits, e.g "not if the comment author is an admin ...").
  • Rules Action: send mail to all users of a role, with role = administrator.

Use the Rules UI to import this rule in your own site, no tuning of any kind needed to make it work as requested in this question, except that you may want to refine the eMail title and eMail body to fit your own needs.

Please admit, this is probably the most basic custom rule one could ever think of, in plain English: "Whenever a comment is inserted, send an eMail to all admins".

Your Answer

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

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