Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: How To Disable Comments For Nodes Of A Certain Type

Submitted by on September 10, 2010 – 9:48 amNo Comment

It is necessary to disable comments for nodes of a specified type. There should not be any comment, link on the form for adding a comment etc. when the node viewing.

Solution


Comments settings are stored in a database individually for every node. And you can set general comments settings (default settings) on setting page for the required node type. However, these settings will be applied for new nodes only.Therefore there are 2 phases of comments disabling – for new nodes and for existing nodes.

Disable comments for new nodes

To disable commenting for new created nodes of the specified type, you should:

  • Open settings page for this type of nodes (page, story or something other): admin/content/node-type/[node type]
  • Open Comment settings
  • Set Default comment setting parameter to Disabled
  • Save settings

Disable comments for existing nodes

Alternatives

  • Using SQL-snippet
  • Using Mass Change module

Using SQL-snippet

To disable comments in already crated “story” nodes you should execute SQL-snippet:

UPDATE node SET comment = 0 WHERE type LIKE “story”;

Possible variants:

  • comment = 2 – read and write comments
  • comment = 1 – read comments only
  • comment = 0 – comments disabled

Change “story” value to 2, 1 or 0.

Using Mass Change module

Install Mass Change module and you will be able to do mass change of node parameters including comments settings. Please do not forget to disable this module – there is no need to use it all the time!

Summary

SQL-snippet is a fast solution. Using of the module makes sense if you are going to make mass change to node parameters frequently.

Used materials:

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.