Hi!

I have some troubles with comments settings. I can disable comments for each specific node, but i can't find a possibility to disable comments generally for specific content type.

Comments

mshepherd’s picture

From your content types admin page at admin/content/types edit the content type on which you want to disable comments.

In the Comment settings section, set Default comments setting to Disabled. Save the content type.

This will only change new posts. Any existing posts will have to be changed manually by editing each node.

addyon’s picture

"This will only change new posts. Any existing posts will have to be changed manually by editing each node."

That helped sooo much. Thank you!

Be the change you wish to see in the world around you.

adelayde’s picture

I'm still learning about how Drupal works under the hood, so please bear that in mind, but it seems that the comment setting on the Content Type acts as a template for any nodes created using it, therefore as the other poster said, you need to go back and change all your old nodes, which can be a bind.

If you're happy diving into the database and doing it via SQL you can with the following queries, which I've tested on Drupal 7, but looking at the db structure for Drupal 6, should work for it as well:

We need to set the 'comment' column in the table 'node' to '1' for any of the nodes that we don't want commenting enabled. Make sure you select the correct 'type' (that is the internal or machine name of your Content Type)* - in my case I have a content type 'announcement':

UPDATE node SET comment=1 WHERE type='announcement';

Now in actual fact this won't do anything! The actual setting is stored in the node_revision table, so we have to do it there as well (we did the first statement for consistency's sake):

UPDATE node_revision SET comment=1 WHERE nid IN (SELECT nid FROM node WHERE node.type='announcement');

That did the trick for me, and saved me the aggro of a load of mouse clicks to do the same thing.

* to get a list of the machine names of the Content Types use:

SELECT name, type FROM node_type;

jeff.hines’s picture

Thanks for the SQL snippets! I made 100+ pages/books and then needed to disable comments. This is my first Drupal site, but so far I'm pretty impressed with the depth of everything, including the users.

Thanks,

hockey2112’s picture

Thanks, this worked like a charm! I had to clear my cache for the changes to be visible.

mwangi’s picture

thanks, it worked for me too

hht1230’s picture

I tried the above for a new content type, and I don't see Disabled in the 'Default comments setting for new content' menu; only Open, Closed and Hidden. I'm still unable to disable comments on my custom content type. Is this a bug?

Kirk’s picture

The option you want to choose is "Hidden"

Open - allows people to post comments
Closed - shows comments that have been posted in the past, but new comments cannot be posted
Hidden - 'disables' comments. No comments are displayed and none can be added.

The setting that you make on the content type edit screen is not a retroactive change. Meaning that if you have existing content that you have created, and you change the default setting, the existing content will not be effected. In order to hide the comments on existing content, you have to do one of the suggested above methods. Either edit each page and change it to hidden, or execute a SQL query.

Kirk from Fantombox
http://fantombox.com

hht1230’s picture

Thanks, Kirk, for the quick reply. Hidden worked as you said. Then I edited each pre-existing entry and set Comments to Closed (options there were Open or Closed), which disabled comments on those.

symphonymous’s picture

Heya, you don't need to fiddle with the SQL to disable all comments,

just go to permissions, hunt for 'comments' and tailor it.

TanvirAhmad’s picture

This is real idea, cause when u disable comment, comments on the nodes created before dosbaling comments, will be still there, so the good way to to go to permissions and do the stuff.

http://drupaldr.blogspot.com

t@n

sparky888’s picture

FYI, for anyone reading this after July 2014...

You go to the content type (Admin > Structure > Content types), edit it, then select comments from the Comment Settings, and in the 'Default Content Settings for New Comments' set it to Closed.

If you need to remove old content, go to Admin > Content > Comments, and there you can remove any comments you wish to.

Hope this helps.

Stephen Parker
Professional Marketer, Developer and Data Analyst
Co-founder, Gravital Digital - Sunnyvale, CA | Orlando, FL
gravitaldigital.com | 407-710-5497
@gogravital