1

The answer to "How to restrict node authors from commenting on their own nodes?" includes a rule that unpublishes comments made by an author on his own posts. The rule works and is reproduced below.

{ "rules_unpublish_selected_comments" : {
    "LABEL" : "Unpublish selected comments",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "comment" ],
    "ON" : { "comment_insert" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "comment:node:author" ], "value" : [ "comment:author" ] } }
],
    "DO" : [ { "data_set" : { "data" : [ "comment:status" ], "value" : "0" } } ]
  }
}

To refine it further, how would you modify the rule so that the comment author could reply to comments made by others on his own post or node?

  • I would suggest you to rethink the approach of using that rule. Giving user an ability to post a comment, and seconds after make them realize that it will never be published - is just not a very good user experience. – oksana-c Apr 21 '16 at 18:41
  • Not sure I understand what your actual question is here. But could it be that your last word of your question should be "node", and not "comment"? Also, maybe you should add a sample scenario with a node , then author of the node, one or more users who post a comment, and then explain what exactly you'd want to allow or disallow... – Pierre.Vriens Apr 21 '16 at 19:26
  • When a user leaves a comment on a comment, there is a "reply" link under his comment. What I am trying to do is allow the author of the original comment to reply to that second comment. – user14666 Apr 21 '16 at 19:30
  • @oksana-c : would that rule seem more acceptable to you by just adding another Rules Action to display a Drupal message to inform that user about the automatic unpublish (to teach them while they are not respecting the rules)? – Pierre.Vriens Apr 21 '16 at 19:30
  • But @oksana may be right. Maybe hiding the comment form from the comment author is a better approach. It's food for thought. – user14666 Apr 21 '16 at 19:34

Your Answer

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

Browse other questions tagged or ask your own question.