Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ollioi on
How can I filter, if a comment is a new comment to a node or is an answer to another comment. As far as I can see, it is always the same form-id.
In other words: I added some voting fields to comments. Now I want users to be able to answer to a submitted comment, but the answer to the comment should not include the voting fields in the form.
I could hide it via css using "comment-form--2", but then the fields are hidden in another context, where they should be seen.
Thank you!
Comments
You should be able to
You should be able to implement hook_comment_view(), and to some checks in there. Set #access = FALSE for any fields you don't want to show.