Questions tagged [comments]

Use it for questions about the comment entity.

Filter by
Sorted by
Tagged with
11 votes
10 answers
7k views

How do I enable comments for user profiles?

With users being entities in D7 I assumed the user type would would have built in "comment" option. That doesn't seem to be the case. I just want to allow users to leave comments on the user profile ...
uwe's user avatar
  • 12k
15 votes
5 answers
10k views

How To Show Node Comment Count in node.tpl?

I have had the bright idea of changing my user permissions so as guests cannot see the comments on a node. I have no problems with Views around my site, as they can clearly see there are comments on ...
Reg Gordon's user avatar
7 votes
2 answers
3k views

How to get the node id the comment is attached to in hook_comment_insert?

How can I get the node id the comment is attached to in hook_comment_insert? I tried the following code: function mymodule_comment_insert(Drupal\Core\Entity\EntityInterface $entity) { if ($entity-&...
D34dman's user avatar
  • 326
6 votes
1 answer
1k views

How to create a view of unread comments on own nodes for the user's profile page?

I'd like to create a view for the user's profile page that displays all unread comments on the nodes he/she created. When I say 'unread', I mean that the page where the comment is situated (namely, ...
Jeroen's user avatar
  • 2,518
6 votes
3 answers
8k views

Warning: Cannot modify header information - headers already sent

My log is cluttered with this message: Warning: Cannot modify header information - headers already sent by (output started at /home/path/to/drupal/7/includes/common.inc:2681) in drupal_send_headers() ...
camcam's user avatar
  • 2,111
4 votes
1 answer
3k views

How to limit a user to one vote when using Fivestar?

In Drupal 7 I have enabled the fivestar module to allow users to vote in their comments. The results are tallied and give an average vote. Cool stuff. Problem is a person can just keep voting over ...
blue928's user avatar
  • 3,804
3 votes
1 answer
8k views

How to display comments of current node in a view

I would like to display comments of the current node in a view. The reason for doing so is that I want the comments to be neatly displayed in a table and views seems to be an easiest way to do so than ...
Baba's user avatar
  • 541
1 vote
1 answer
115 views

Showing comment form under each paragraph

In node.tpl.php, I have done some changes, like creating an array of paragraphs: $paragraphs = explode("<p>",render($content)); So, I have a for loop for showing the paragraphs, like: $...
user3530082's user avatar
6 votes
7 answers
5k views

How to delete all unpublished comments?

I have literally thousands of unpublished comments. I am wondering what is the easiest way to git rid of them altogether. Thanks
alfish's user avatar
  • 1,947
5 votes
3 answers
4k views

Change date format in comments

How can I change the date format in my comments? Right now it looks like this: Sat, 09/01/2012 - 12:00 I want it to look like this: Saturday, September 1, 2012 I was able to achieve this in ...
Jane's user avatar
  • 1,805
4 votes
1 answer
249 views

How to hide rating field when adding comment to own node?

On my website, users can rate nodes with the Fivestar module while adding a comment. In other words, the rating field (called 'stars') is part of the comment. Now, I'd like to hide the rating field ...
Jeroen's user avatar
  • 2,518
3 votes
1 answer
181 views

How to implement an option for users to limit access to nodes/comments to users with the same role while posting it?

How can I offer users an option on all node/comment postings to limit access to their own user role group? Essentially making the conversation accessible only for the members of their own year who ...
whatsnewsisyphus's user avatar
3 votes
1 answer
230 views

How to create a Rule to create a new entity of type Comment and a body with tokens?

Using drupal 7 and the Rules module, I'm trying to "create a new entity" of type comment. What it's strange, is that although all the other fields accept tokens, "the main body text" doesn't. Tokens ...
Kropot's user avatar
  • 271
2 votes
1 answer
480 views

Is there a way to stop comment_node_view from firing?

I need to use the Commentsblock module, but it is turning out to be pretty buggy. I've got an issue in the queue with a patch for comments not displaying for anonymous users. Now I've got a second ...
Joshua Stewardson's user avatar
1 vote
1 answer
927 views

How do I remove default comment validation in drupal 7?

Drupal is showing error message for empty comments by default. how can i remove that error message. Note:- (I have not written any custom validation. It's the default validation provided by drupal ...
Ajmal's user avatar
  • 323
1 vote
2 answers
210 views

How can I use the unapproved comments list as a block?

The unapproved comments list (available at /admin/content/comment/approval) allows me to perform bulk operations on comments such as deletion (which also gives me the option of reporting to Mollom) ...
detly's user avatar
  • 200
0 votes
2 answers
115 views

Information of the user in comments

I want to show the information of the author in his comment. By default it shows the name and the picture, I want to add: The number of node and created comments The number of obtained userpoints. ...
Frouite's user avatar
  • 21
0 votes
2 answers
649 views

Cycle comments on field--comment.html.twig

I would like to add a div for every comment on my field--comment.html.twig On the template I've a "comments" variable, but if I cycle in this way, I obtain error (Fatal error: "0" is an invalid ...
arrubiu's user avatar
  • 3,222
20 votes
3 answers
8k views

Remove subject field from comments

Is it possible to remove the subject field on comment forms? I find it to be kind of useless and redundant, since the subject of the comment is usually the title of the article being read, at least ...
Lester Peabody's user avatar
12 votes
13 answers
14k views

How to finally disable comments on content type?

I am trying to disable comments on webform. I tried all settings I could find, but: Link to comment form still appear Name field and submit button still appear on comment form Could somebody give me ...
Codium's user avatar
  • 4,955
10 votes
3 answers
1k views

Why are comments not a node content type?

So Drupal has a 'special' commenting system. Comments are second-class citizens in Drupal compared to nodes... But why did the core team not just create a default Content Type, Block and View for ...
dayuloli's user avatar
  • 579
9 votes
3 answers
2k views

How to noindex comment/reply in Drupal 7

I use Drupal 7, and I am trying to use the "noindex" meta tag to prevent http://example.com/comment/reply/43/738 from being indexed by search engines. The comment/reply page is being indexed, even ...
Naweed Chougle's user avatar
9 votes
5 answers
6k views

Disabling CKEditor in comments

Does anyone know of a way to force plain text mode in comments for all roles? Edit: is it in any way possible to do so through CSS? Thanks!
Jane's user avatar
  • 1,805
7 votes
4 answers
3k views

How to remove the default "Anonymous" from comment author name?

In the comment form field (core comment module) I would to leave the comment author name empty, in order to encourage commentators to come up with original epithets. What's the easiest way to do it?
daphshez's user avatar
  • 1,082
7 votes
1 answer
6k views

Print the comment form with PHP

I'm trying to print a comment form with the following code. <?php print drupal_get_form('comment_form', array('nid' => $row->nid), t('Post new comment')); ?> All I get is the ...
emc's user avatar
  • 863
6 votes
3 answers
283 views

Is there a way to make the comment module email the administrators when a comment needs approval?

I'd like to be notified whenever comments are made on the site which require administrator approval before publishing; basically, I'd like to know when something new appears in the Approval Queue. I ...
Joe Corkery's user avatar
6 votes
2 answers
2k views

Comments sorted by oldest first

I've set my comments display order to be oldest first. When there are more comments than the number allowed per page, the comments are spread across 2 pages and a pager is provided. My issue is that ...
Evanss's user avatar
  • 2,026
5 votes
1 answer
4k views

How to change "Your name" label in comments form?

I have a blog with comments and I need to change the "Your name" field to something different and make it a required field. Can I do this from hook_form_comment_form_alter() hook in template.php or ...
joshas's user avatar
  • 285
5 votes
1 answer
1k views

add comment form in views

I've created a views from comments. I want to have add comment form at the button of my views (in footer). so I installed "views_php" module and add "Global: PHP" to footer and write this code to ...
shekoufeh's user avatar
  • 589
5 votes
2 answers
255 views

How can a poster of a comment notify selected users about a new comment?

When I write a comment on a node, I want to be able to select the users that will get a notification (via e-mail) about that new comment. Basecamp has this feature and I think it is very cool. Is ...
Jose San Pedro's user avatar
5 votes
4 answers
4k views

drupal 7 comment moderation modules

I am looking for modules that can extend drupal 7 comment admin. For example, I want to be able to set different statues for comments, like Approved, pending, spam and unapproved. And maybe comment ...
Funky Dude's user avatar
4 votes
4 answers
5k views

How to remove the "Add new Comment" link from book pages

I have created two books, and both of them have child pages (which are also book pages). I have activated the option of commenting, in which the comment box is shown in the same book page. All works ...
AjitS's user avatar
  • 10.9k
4 votes
2 answers
3k views

Placing the comment form on a separate page

Is it possible to place the comment form for a content type on a separate page? I have some teasers on the home page and since I did them using Views, I need to find a way for people to add comments ...
enchance's user avatar
  • 2,039
4 votes
1 answer
441 views

posting a comment on cached page

I am a bit confused now - is it normal behavior that posting an anonymous comment on cached page invalidates ALL cached pages for whole site for current anonymous user? Beacouse that is exactly what I ...
loparr's user avatar
  • 906
4 votes
2 answers
2k views

Can you bulk enable comments?

I have a whole bunch of nodes (all the same type), and I'd like to turn comments on for all of them (the client changed their mind about commenting after all of the data was added). I've found notes ...
Tim Howland's user avatar
4 votes
2 answers
355 views

Custom comment access

I need to prevent users from posting comments based on some conditions but I can't find any hooks I can implement. For nodes we have hook_node_access() but apparently there is no hook_comment_access()...
Marius Ilie's user avatar
  • 3,072
4 votes
3 answers
375 views

How to approve comments from a user with previously approved comments

WordPress has a useful option for comment moderation in its Discussion Settings panel called "Before a comment appears: Comment author must have a previously approved comment". How can one configure ...
Mike Eng's user avatar
  • 185
3 votes
3 answers
232 views

How to restrict node authors from commenting on their own nodes?

On my site we have enquiries (nodes) and price quotes (comments). So node authors shouldn't be offered to quote prices to themselves. That's why I want to disallow node authors comment their own ...
Timur Kutuev's user avatar
3 votes
1 answer
2k views

Enable / Disable comment form in a module?

I would like to set a given node's comment flag to 1 or 2 (to either show or hide the comment form) via my custom module, depending on certain conditions. I have tried using hook_node_view, but this ...
geerlingguy's user avatar
  • 5,483
3 votes
5 answers
6k views

How to change "add to comment" in comment form?

When CCK was not in core, as in Drupal 6, and you selected a node type for comments on other node types, the comment form would say the name of the content type instead of comment. In this case, I ...
the1brit's user avatar
3 votes
3 answers
3k views

How do I redirect back to the source page after the user submits a comment?

How can I access the nid of the current page so that a user can submit their comment and be returned back to the page they just commented from. Here's what I am proposing... function ...
dbj44's user avatar
  • 4,744
3 votes
1 answer
2k views

VIEW COUNT comments total per node

I have found code to show the total: How To Show Node Comment Count in node.tpl? Unfortunately I need to have this value available via VIEWS because I want to list 5 nodes based on total comment ...
Alex.Barylski's user avatar
3 votes
1 answer
224 views

How to run the Flags module after the Rules module?

As a sequence on this question, I'd like to deduct 2 User Points when a user's first reaction on an Article is deleted (I mentioned my flag 'First reaction' there). I created a Rule 'Reaction removed' ...
Jeroen's user avatar
  • 2,518
2 votes
1 answer
75 views

How to remove some comments from a node?

I created a new table in the database to associate comments to the node version they were submitted against. Now when the node renders, I only want to display comments that are associated with the ...
digitgopher's user avatar
  • 1,591
2 votes
1 answer
2k views

Wrap comment replies in a collapsible fieldset

I found an article about wrapping all comments (http://scito.ch/content/wrap-comments-collapsible-fieldset), but I just want to wrap comment replies in a collapsible fieldset. How do I achieve this?
younger870's user avatar
2 votes
1 answer
158 views

How to add a comment form in VBO to add the same comment to mutiple nodes?

I am using "Comments" as a note option. I want to let users add the same comment to multiple nodes with the Views Bulk Operations (VBO) module. How do I get the "Add Comment Form" in VBO to achieve ...
Girish Cholayill's user avatar
2 votes
1 answer
1k views

How to link to last comment on a node page?

I have some nodes with lots of comments that use a pager. I want to link from the top of the node page to the last comment. Is there a simpler way than building the link like this (source): Get ...
uwe's user avatar
  • 12k
2 votes
1 answer
109 views

How to loop through comments using the Rules module?

I have created a rule (using the Rules module) using Rules Event "After updating existing comment" and some comment fields must be changed. Loop node:comments is used but nothing happens when ...
gladiatorhl2's user avatar
2 votes
1 answer
802 views

Show comment author e-mail in comment.html.twig

Anonymous users can leave their e-mail when posting a comment but how can I display this e-mail as a plain text value in the comment.html.twig?
rroose's user avatar
  • 360
2 votes
3 answers
461 views

How to view "your own comments" without the permission view comments?

In Drupal there is a permission "view comments" and "add comments". I would like to activate "add comments" and disactivate "view comments". How to allow to view your own comments for users? It's a ...
gladiatorhl2's user avatar