Disable comments by default for specific content type

Thu, 03/15/2012 - 00:36 -- Sam

You can disable comments from your content types admin by editing the content type on which you want to disable comments.
Go to admin/content/types, In the Comment settings section, set Default comments setting to Disabled. Save the content type. You are done! But, this will only change new posts, what for the existing posts? You have to change them manually by editing each node. It can be a bind.
We are going to do it via SQL snippets which I've tested on Drupal 7 and should work for Drupal 6 as well (in my case I have a content type 'quotation'):

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

Now as the data is stored in the node_revision table, execute the next query:
UPDATE node_revision SET comment=1 WHERE nid IN (SELECT nid FROM node WHERE node.type='quotation');

That it's. Happy Drupaling!

Add new comment

Tweets

@csscutie on

Azul