0

I have a Drupal 8 site with Flag and Rules modules. How to flag a new comment ?

I want that when a user creates a comment, the comment should be automatically flagged.

I created a type of Flag on the comments and I created a rule with the event "When a new comment is posted".

What should I put in action ?

enter image description here

enter image description here

1 Answer 1

0

Flag ID should be the ID of the flag being set. If you go to /admin/structure/flags, and Edit the flag, the machine name/ID of the flag will be at the end of the URL -- so /admin/structure/flags/manage/{flag_id}.

I've not used Rules on D8, but for Entity ID, if you click "switch to data selection" and then click the field, I think it should give you some autocomplete options to help select the data you want. You'll likely end up with something like "comment:id".

4
  • I just tested but it doesn't work ibb.co/bWbJ00g
    – sdfff
    Sep 12, 2020 at 1:16
  • Does it let you drill down any further? Seems like that isn't grabbing the actual value of the cid for whatever reason. Also...anything useful in the Provided Variables fieldset below?
    – Mrweiner
    Sep 12, 2020 at 1:28
  • I don't know how to use c module, because it is not as simple as in drupal 7
    – sdfff
    Sep 12, 2020 at 1:47
  • Not sure what you mean by "c module". You may want to look at drupal.org/project/rules/issues/2920651#comment-12328109 and drupal.org/project/rules/issues/2763945#comment-12358180 for info on how the data selector works. It might be as simple as using comment.cid.value. Past that I think we'll need to wait for somebody with more D8 Rules experience to drop in for guidance.
    – Mrweiner
    Sep 12, 2020 at 1:52

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.