Questions tagged [comments]

Use it for questions about the comment entity.

Filter by
Sorted by
Tagged with
0
votes
1answer
27 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 ...
1
vote
0answers
64 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 ...
0
votes
1answer
20 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 ...
0
votes
1answer
20 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 ...
0
votes
2answers
29 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?
1
vote
1answer
38 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 ...
1
vote
0answers
47 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 ...
2
votes
1answer
89 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 ...
0
votes
0answers
39 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 ...
4
votes
2answers
42 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....
0
votes
1answer
45 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 ...
0
votes
1answer
30 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 ...
1
vote
1answer
47 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 ...
0
votes
1answer
21 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?
1
vote
1answer
129 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--...
1
vote
1answer
90 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.
1
vote
1answer
90 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 ...
0
votes
0answers
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 ...
0
votes
1answer
161 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 ...
0
votes
1answer
37 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 }} ...
1
vote
0answers
21 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 ...
1
vote
1answer
25 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....
3
votes
1answer
92 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 ...
-1
votes
1answer
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 ...
-1
votes
1answer
260 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 :
0
votes
1answer
27 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 ...
0
votes
1answer
144 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? ...
0
votes
1answer
58 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 ...
0
votes
1answer
22 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" ...
1
vote
2answers
495 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 ...
1
vote
2answers
46 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 ...
1
vote
0answers
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) ->...
0
votes
1answer
52 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') ...
1
vote
2answers
50 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 ...
4
votes
1answer
4k views

Mismatched entity and/or field definitions for comment field

I have been receiving this message ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. Comment The ...
0
votes
0answers
335 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 ...
0
votes
1answer
19 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 .. ...
0
votes
0answers
29 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 ...
0
votes
1answer
142 views

comments module with infinite scroll

I've added a comment field to my content type. Now I'd like to add infinite scroll to the comments messages, so it shows by default some number of comments and when I click on the load more button, it ...
0
votes
0answers
31 views

change Comments per page

I need to change the comments per page value, I set it 50 from the field setting but in some pages, I need showing only 10 comments, not 50. I tried to use this method setSettings([ 'per_page' =...
0
votes
0answers
41 views

How do I name the comment.tpl.php file to use it in my own theme?

I have copied comment.tpl.php from mytheme/modules/comment into root/sites/all/themes/mytheme/templates. What should I name it to override the core template? The form ID is places-to-go-entry. I ...
0
votes
1answer
409 views

How do I fix the errors I get after removing the comment field from a content type?

After I removed the comment field from the user interface, and uninstalled the Comments module, I can't open any Article node. In the Drupal log, I find this message. InvalidArgumentException: ...
1
vote
2answers
1k views

How to render author custom fields info on comment and node twig template?

I am trying to render the author Full Name and other authors customs fields information in comment.html.twig and node.html.twig. But not any of the fields that I made for users such as "First Name", "...
1
vote
2answers
94 views

How can I leave Subject as blank when fill nothing in the subject field of a comment?

When we fill nothing in the subject field of comment, drupal will use the comment body as the value of subject. See the code in CommentForm::buildEntity // Validate the comment's subject. If not ...
0
votes
0answers
42 views

Displaying same username for all users with a specific role as comment author

I need to display the same username for users of a specific role as comment author. I have a Role 'Board Moderator'. When users with this role are commenting, a uniform name 'OneUserNameForAll' ...
1
vote
1answer
47 views

How to create a view to count comments per user?

I am trying to create a view with a table that shows all the users and the total number of comments that user posted in descending order. I am not sure what I am doing wrong but I spent hours on this ...
0
votes
0answers
121 views

What's the correct way to create a custom formatter for a comment?

I'd like to create a custom formatter for the field Comments. My goal is to display a custom comments section beside CKEditor (URL /node/xx/edit). Following this article, I created my custom module: ...
0
votes
0answers
58 views

Comment file upload not working

Looks like we have two versions of jQuery loading. Hence the "(...).once is not a function" errors in the console. jquery.once is definitely loaded but only for the first version of jQuery. Nightmare....
-2
votes
1answer
500 views

How to add reply link under every comment?

I using standart Drupal 8 module for comments. Can I add reply link under comments or I have to install another module? I'm log in as administrator, but i dont see edit/delete/reple link Help please!...
-1
votes
1answer
74 views

Can not use a comment display mode

In my comment type, I created a "teaser" view. When I enable the debug mode in the "service.yml" file, the display modes of the comments do not appear in the suggestions. Why ? How to use a ...

1
2 3 4 5
17