Questions tagged [comments]

Use it for questions about the comment entity.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How do I eradicate all lingering traces of the Comment Goodness module? [closed]

In an attempt to make my comments section more useful, I installed the Comments Goodness module. What a mistake. It broke my comments from a formatting perspective; it also (I believe) disabled my ...
user avatar
1 vote
2 answers
80 views

View only your own comments, no one else's?

I have a client who would like users to be able to comment on content without being able to see any other users' comments. This is for a review system where users shouldn't feel influenced by the ...
user avatar
1 vote
2 answers
64 views

How can I get Average of a comment field by node_id?

I have Comments here wherein user can rate a content. I want to get the average rating per content, how do I efficiently get the average? I have the following code to get the Average: $cids = \Drupal::...
user avatar
0 votes
0 answers
18 views

Error while deleting a comment related to a paragraph

I'm having a problem while deleting a comment linked to a paragraph. Has anyone encountered problems of this kind and would be able to help me with the solution? The error code is attached. Thank you ...
user avatar
1 vote
1 answer
76 views

How can I enable workflows for comments?

I would like to create workflows for comments and moderate them, but I can't find comments under This workflow applies to: on /admin/config/workflow/workflows/manage/comment_workflow. Does anyone know ...
user avatar
  • 27
0 votes
1 answer
48 views

Display comments only for users with "administer comments" permission

In hook_node_view_alter, I'm trying to restrict the display of comments to users who have the "administer comments" permission. So far I have this but it is not working. if (isset($build['...
user avatar
  • 23
1 vote
2 answers
161 views

Confirmation message on comment submission

When a comment is submitted, no confirmation message is shown and I would like to achieve this. I want to show the following message. Your comment has been added for review and approval. I tried ...
user avatar
  • 33
0 votes
1 answer
51 views

Plugin not found

I am overwriting the CommentBulkForm class in my module. namespace Drupal\mymod\Plugin\views\field; use Drupal\comment\Plugin\views\field\CommentBulkForm; /** * Defines a custom comment operations ...
user avatar
  • 33
0 votes
1 answer
22 views

getCommentedEntity returns null

I have a comments page set up and when I devel the page for a specific comment I see the getcommentedentity method. I am trying to get the commented entity details using the below code in my VBO ...
user avatar
  • 33
1 vote
1 answer
62 views

Comments on user profile not working

I want to add comments to user profiles. I added the comments in user profile under Configuration > People > Account settings, but when I add the field, the option to select the comment type is ...
user avatar
  • 302
1 vote
1 answer
66 views

How do I get the comment ID in a template file?

I want to show the comment title linked to the comment permalink. This is the content of the comment.html.twig file. <div{{ content_attributes.addClass('comment__content') }}> {% if title %}...
user avatar
  • 13
0 votes
1 answer
38 views

How to remove comments from all nodes

I want to remove the comment section from all my articles. Can this be done with an sql query or something so I don't have to do it manually by setting comments to disabled ?
user avatar
  • 1
0 votes
0 answers
23 views

Option to set comments to Hidden on an individual piece of content (node), even when it has no comments

Drupal 8 and Drupal 9 comment fields provide three settings for the default, as configured at for example /admin/structure/types/manage/article/fields/node.article.comment: The default value for this ...
user avatar
  • 1,312
0 votes
1 answer
53 views

How to get comment cid in hook_comment_insert?

I've read the answers to How to get the node id the comment is attached to in hook_comment_insert? and found how to extract the nid of the node the comment is associated with. However, I also need to ...
user avatar
  • 14.8k
1 vote
0 answers
92 views

How do I fetch all users in a comment thread?

I want to send notifications to users that have posted in a comment thread. I need to get the user IDs in an event subscriber that will be triggered when comments are created/edited, so performance ...
user avatar
0 votes
1 answer
98 views

Incorrect string value: '\xF0\x9F\x92\x99' for column "'comment_body_value'"

How can I fix the following error I get from a Drupal 7 site? Incorrect string value: '\xF0\x9F\x92\x99' for column "'comment_body_value' I read it is about users posting emojis that cannot be ...
user avatar
  • 41
0 votes
1 answer
29 views

Render published content or comments on new created content using a link

I was looking without luck for a way to be able to make a link or button with the functionality of making a new content showing some content or comment already posted above, something like the Retweet ...
user avatar
  • 75
0 votes
2 answers
71 views

Hide comment box from node for Anonymous users

I am trying to hide the comment box for anonymous users. Anonymous users should only be able to view the comments. How can I hide the comment form?
user avatar
  • 27
1 vote
1 answer
41 views

How do I add a view between display fields of a node?

I have a view that displays a table at the bottom of every node. It's part of the content of the node so I want to have the "comments" section below the view. However, the comments are a ...
user avatar
  • 498
1 vote
0 answers
105 views

How to extend existing 'access comments' permission?

I am trying to extend access to comments based on the entity they are attached to. I have created permissions in my permissions.yml file as following. view user comments: title: 'View comments ...
user avatar
  • 101
2 votes
1 answer
372 views

How to add comment form to a view of nodes in Drupal 9?

I'm using views to display the fields of nodes. I prefer to use fields because it allows me to use relationships (bring in author profile picture etc.). Adding the Content: Comments field shows the ...
user avatar
  • 461
0 votes
0 answers
76 views

Custom jQuery action on AJAX events

I'm trying to use a custom javascript event when certain actions are performed on my site, specifically things like Webforms, or Node Comments being submitted (both of which are setup to submit via ...
user avatar
4 votes
2 answers
61 views

Alter comment pager to jump to comment section right away?

I set up a content type and a specific comment type for this content. I set the comment pager to display 10 comments per page. When I now use the pager, I get redirected from the node URL itself www....
user avatar
0 votes
1 answer
116 views

How can I automatically flag new comments?

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 ...
user avatar
  • 61
0 votes
1 answer
48 views

'Add new comment' link/button does not display on custom entity

A new comment type is created and added as a field (say x_comments) to a custom entity. The comments show up and work as expected. However when the x_comments field is configured to disable 'Show ...
user avatar
  • 434
1 vote
1 answer
159 views

How to print "node title" in comment.html.twig template?

i am styling my comments in comment.html.twig template and need to show "node title" of the node to which the comments belong. I've tried a number of options, and the only one that works ...
user avatar
  • 169
0 votes
1 answer
71 views

How to hide "Log in or register to post comments" when I've already disabled displaying comments?

I already disabled comments. How can I remove the "Log in or register to post comments" text at the bottom of articles or other content types?
user avatar
1 vote
1 answer
328 views

twig template suggestion for comment reply form

there is no template suggestion for a comment reply form in Drupal 8, how can i create one? i am not talking about the reply form displayed in the node for which Drupal suggest a template : field--...
user avatar
1 vote
1 answer
123 views

Allow comments only for the author of the node

I'm using Drupal 8 for a personal project and I'd like to allow only the node author to post comments. Can you please help? I'm stuck.
user avatar
1 vote
1 answer
309 views

Display comment form without the comment thread

What are some ways of rendering a comment form without also displaying the comments? What about creating a block contains the form? If that's possible, what are some links to documentation touching ...
user avatar
  • 433
0 votes
0 answers
28 views

Is there an easy way to programmatically add a comment field to a content type? [duplicate]

I currently have the following code in a D8 module: $sql = 'CREATE TABLE `comment__field_follow_up_date` (' . "`bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The field ...
user avatar
  • 123
0 votes
1 answer
347 views

Show Comment Form on its own Page or Popup

I am trying to figgure out how to show the comment form on its own page. So far I have been able to show it on a seperate page. All I had to do was to go to field comment setting and uncheck "Show ...
user avatar
  • 591
0 votes
1 answer
70 views

How to display an alternative text if the comments are closed for the node?

in my node type template, how do I display alternate text if comments are closed for the node ? {% if content.comment %} <div class="card mb-5 p-3 shadow"> {{ content.comment }} ...
user avatar
1 vote
0 answers
30 views

How to add custom query to comment entity

I have comment thread field attached into a node. I would like to have a search function by keyword. I used hook_query_TAG_alter() to add database condition according to my needs. Here's my current ...
user avatar
1 vote
1 answer
29 views

Add text message under "Add new comment" title

I would like to add a disclaimer message under "Add new comment" title and above the form in drupal 8 site. I changed the help text on this path /admin/structure/types/manage/article/fields/node....
user avatar
  • 89
3 votes
1 answer
329 views

Where do I find the comment IP address?

I am searching for comments ip address in D8 and I can't find where they are located in database. In D7 it was easy to find. Is there a chance that D8 is not storing the commenters ip address? If it ...
user avatar
  • 89
-1 votes
1 answer
30 views

Commenting or replying a specific node without the possibility of commenting others?

I built a website sort of like an online directory for restaurants in my home town, and I am letting the users to leave their reviews about a specific restaurant, and what I need is to give access to ...
user avatar
-1 votes
1 answer
513 views

How to count the number of comment and flag in a node?

I want to display on my node the number of comment and flag. What should I add to my TWIG to get this? How to count the number of comment and flag in a node? Here is an example :
user avatar
0 votes
1 answer
49 views

Add a Radio-button with other option in comment type

I have the following requirement in Drupal 8: I have to create a comment type with options. In options there will be a Other option on whose click a text field will be opened. something like below ...
user avatar
  • 23
0 votes
1 answer
240 views

How can I prevent "Log in to post comments" from displaying for anonymous users?

How do I remove the "Log in to post comments" from the bottom of my content in Drupal 8 while keeping old comments visible to all and allowing existing registered users to still comment? ...
user avatar
  • 331
0 votes
1 answer
84 views

How can I display the time passed since a comment was created instead of the creation date?

how to personalize my comments ? I want to display since when the comment was created instead of the date. I want to display the comment ID with the link "permalink". Can you help me ? Thank you ...
user avatar
0 votes
1 answer
54 views

Get Relationship for the Author of the Latest Comment

In a Node view, I am trying to group the latest comments by the author's field_last_name, but I am having difficulty adding this field. I tried using the the "Last comment" and "Last comment author" ...
user avatar
  • 1,720
1 vote
2 answers
891 views

Twig template print all comments but not the comment form

For context: in my template file node--some-node.html.twig i have a grid of items which have a custom comment form on them. The form creates a comment through an API. The form passes the ID of the ...
user avatar
  • 23
1 vote
2 answers
52 views

Rules scheduler reacting on last comment?

I have a content type with comments activated and would like to have a rule that triggers a component when there is no new comments posted after a week. The component works as designed with rules ...
user avatar
1 vote
0 answers
27 views

How to create a query nodes, that queries content with more than one comment?

Consider this example: $query = \Drupal::entityTypeManager()->getStorage('node')->getQuery(); $nids = $query->condition('type', 'question') ->condition('status', 1) ->...
user avatar
0 votes
1 answer
93 views

How can I load comment IDs using the comment type?

I know how to load comment ids for a particular node by following code $entity_manager = \Drupal::entityTypeManager(); $cids = $entity_manager ->getStorage('comment') ->getQuery('AND') ...
user avatar
  • 437
1 vote
2 answers
52 views

How do I let non-admin user approve comments?

I'm looking for a way to allow a non-admin user to approve comments. I thought a Flag/Rules combination might be a solution but I can't figure it out. I added a content-moderator role, then I ...
user avatar
  • 63
0 votes
0 answers
472 views

How to display number of comments of a node as part of a "content" view with fields

I created a content view in D8, which shows me fields of a content type. Basically it works. Now I would like to have the total number of comments per listed node displayed as a view field ...
user avatar
  • 129
0 votes
1 answer
23 views

override view Use administration toolbar

i have a view that using administration toolbar. Problemis theme suggestion is not showing the template names that should override the template. i guess because its using the administration toolbar .. ...
user avatar
0 votes
0 answers
31 views

Comment body not displaying

I have an interesting problem where the comment body does not appear with the comment. The field wrapping is in the HTML but the content portion is always blank. This problem occurs regardless of the ...
user avatar

1
2 3 4 5
17