1

Has anyone been able to figure out how to notify the node author when new comments are posted on their content?

I understand Rules for Drupal 8 is still in its infancy. When I used various tokes for the TO filed nothing worked.

If anyone could share their solution that would be great.

2 Answers 2

1

... how to notify the node author when new comments are posted on their content??

To my knowledge, the current answer to this question is: not possible yet.

More info

  • Refer to #d8rules status update November 2017 to get a better understanding of the current status of Rules for D8. Here are some (scary) quotes from it:

    • ... Fago can’t dedicate time required to develop the module further. What Rules is really missing at the moment is development capacity to help finish the last milestone.

    • ... Even if we got more funding today, fago the current principal maintainer of the Rules module wouldn’t have enough capacity to do the work himself.

  • Start here if you wonder how to contribute.


One never realizes what has been done, only what remains to be done ...


Plan B

You might want to look at the Message module (and the related modules that belong to the Message Stack), which has a pretty stable release already, and which you could use to create similar functionality.

2
  • Pierre, thanks for the update. I have been looking at the Message module all this morning, but there are no tutorials out there on how to set it up.
    – Progonat
    Commented Feb 7, 2018 at 15:16
  • 1
    @Progonat not sure what to respond to your last comment, but ... (1) you're right, it's tough to find such tutorial (2) have a look at this question, maybe not for the question itself, but for the zillion of links included to questions about the Message module (and answers to them). After you digested those links, you might have a better understanding of this hidden Drupal gem. PS: for new questions about the Message module, use this link ... like you seemed to have done also a few mins ago. Commented Feb 7, 2018 at 15:44
0

It's not at all true that this can't be done in Rules.

There's a working example in the Rules issue queue that was posted in November 2016, so this has been possible at least since then. See https://www.drupal.org/project/rules/issues/2828422

Here's a slightly modified version of that answer to suit your use case. You may import this into your site and look at it in the UI to learn how to configure this functionality.

langcode: en
status: true
dependencies: {  }
id: '2828422'
label: 'Email Node Author on New Comment - Issue 2828422'
events:
  -
    event_name: 'rules_entity_insert:comment'
description: 'Sends email to Node Author when a New Comment is added.'
tags:
  - node
  - email
  - comment
config_version: '3'
expression:
  id: rules_rule
  uuid: b5276280-d0f2-4f64-9512-06f077793c58
  conditions:
    id: rules_and
    uuid: ebf212fc-d858-417d-977d-af1be2cfd886
    conditions: {  }
  actions:
    id: rules_action_set
    uuid: 88a78280-2bca-4367-a4d3-8bbda9397c2a
    actions:
      -
        id: rules_action
        uuid: 5e6e5aed-b75f-412a-9670-48327eb58ba6
        context_values:
          to:
            - '{{ comment.entity_id.entity.uid.entity.mail }}'
          subject: 'Your content {{ comment.entity_id.entity.title }} has a new comment.'
          message: 'Your content {{ comment.entity_id.entity.title }} has a new comment.'
          reply: ''
          language: ''
        context_mapping: {  }
        context_processors:
          to:
            rules_tokens: {  }
          subject:
            rules_tokens: {  }
          message:
            rules_tokens: {  }
          reply:
            rules_tokens: {  }
          language:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: rules_send_email

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.