2

On my D8 site I have configured an action of type "Send email" using the Drupal Core "Actions" module (module can be installed under "Administration > Extend"). I want this Drupal Core action to trigger when a new comment is submitted.

In D7 there was another Drupal Core module named "Trigger" which allowed me to configure the desired trigger. In D8 there's no longer a "Trigger" module, nor can I find any other means to configure any Drupal Core action triggers. In the D8 docs I have found this not-very-helpful paragraph:

In D7, there are triggers defined, supporting the core Trigger module. This is not supported in D8.

My general question therefore is: How can I configure a D8 site to trigger an action that was defined via the Drupal Core module "Actions" when a certain event occurs? Specifically in my case: How can I trigger a "send email" action when a comment is submitted?

As the title of this question mentions, I don't want to write PHP code to achieve this. I am willing to install a stable third-party module, though, as long as it cooperates with the Drupal Core "Actions" module.

In a wider sense, I am trying to understand what the Drupal Core "Actions" module does. To me, the module seems to be quite useless if as a site admin I cannot configure triggers for its actions.

  • But you know of Rules, do you? – leymannx Oct 17 '18 at 11:38
  • @leymannx I've read about it in some other post here on "Drupal Answers", but I ruled (no joke intended) the module out because 1) from what I'm reading on the module page it does not cooperate with Drupal Core actions but defines its own actions & rules & API; and 2) after so many years since the D8 release the D8 port is still in alpha. Did I get 1) wrong? Or in case of 2) is the alpha release actually stable? – herzbube Oct 17 '18 at 12:43
  • 1
    I mean you want Rules without using Rules. The only route is custom code. – Kevin Oct 17 '18 at 13:07
  • 1
    I don't insist on it, I prefer not to use Rules. Trigger was removed from D8 in favor of Rules. But short of using Rules, the only way you will get configurable event/action UI is by using it - or writing code (the way I prefer since its far smaller). See: drupal.stackexchange.com/questions/246353/… – Kevin Oct 17 '18 at 13:23
  • 2
    In this specific case, the smallest amount of code I can imagine is something like hook_comment_insert (or presave, check isNew), if true, call the action as demonstrated in the link provided. – Kevin Oct 17 '18 at 13:25
1

In your specific case the commment notify module would be helpful.

From description,

Comment Notify is a lightweight tool to send notification e-mails to visitors about new, published comments on pages where they have commented. Comment Notify works for both registered and anonymous users.

Otherwise is could be done using Rules I think.

  • Apparently my question was ambiguous, my apologies for that. I'm looking for an answer that relates to actions that were configured using the Drupal Core "Actions" module. I have edited my question accordingly. Nevertheless, thanks for your answer. I will have a look at the module you suggest if nothing else turns up. – herzbube Oct 17 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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