Knowledgebase

How to disable user comments in Drupal

In Drupal there are different settings which allow you to control where and who can post comments on your site. You can remove the comment function for the whole site, or if you don't want to do it you can edit the settings of the user roles and of the content types, in order to disable comments just for particular user roles, or for certain sections of your site.

If you want to disable the comment function completely for the whole site, you can do this by disabling the Comment module. When you install Drupal this module is enabled by default. To disable it, log in to the admin panel of your Drupal and click on the Modules tab in the navigation bar. On the page that opens you'll see listed all the modules. Unmark the checkbox for the Comment module and click on the Save configuration button at the bottom of the page. This will remove the comment functionality for the whole site and it will hide any existing comments.

In case you don't want to remove the function completely, you can also change the comment permissions for the different user roles. You can control who is able to view, post and edit comments. To do this click on the People tab in the navigation bar of the Drupal admin panel. Then click on the Permissions sub-tab that's just above the top right corner of the panel that is displayed. In the table that's shown on the next page you'll see the permissions for the roles under the section Comment. To disable the comment function for a particular role, unmark the checkbox for the Post comments permission corresponding to that role, and optionally the checkbox for the View comments permission. Then don't forget to click on the Save permissions button.

You can also disable comments just for a particular content type(s). The preconfigured article content type, for example, has the comment function enabled by default. To do this you need to edit the global settings of that content type. Click on the Structure tab in the navigation bar of the admin panel. On the following page click on Content types, and on the next one on the edit button for the particular content type. On the page with the settings go to the bottom, click on the Comment settings button on the left, and some comment settings will be displayed. Use the first drop-down menu to select Closed and click on the Save content type button. In this way all future items (nodes) from that content type that are published will be closed to user comments.

Existing nodes from that content type that already have comments will still display them, and all nodes that had been published before you made the change to the global settings of the content type will be open to comments. In this case, if you want to disable comments for those nodes you have to edit the settings for the particular nodes. To do this click on the Content tab in the navigation bar of the admin panel, and on the page that opens click on the edit button for the particular node (e.g. article). Then on the page with the settings scroll down to the bottom and click on the Comment settings button that's on the left. Mark the button for Closed or Hidden and click on the Save button. If you select Closed, existing comments will still be displayed, while with Hidden they will not be shown.

Was this answer helpful?

 Print this Article

Also Read