Skip to content

Drupal - Comments

Comments are a vital part of community engagement on many websites. Drupal provides a flexible system for managing comments on content. You can control whether comments are enabled or disabled per content type, who can post comments, and how comments are moderated.

Configuring Comment Settings per Content Type

Section titled “Configuring Comment Settings per Content Type”

Drupal allows you to define default comment settings for each content type (e.g., ‘Article’, ‘Basic Page’, or custom content types).

Follow these steps to configure comment settings for a specific content type:

Step 1: Navigate to Content Types

In the Drupal administration menu, go to ‘Structure’ > ‘Content types’.

Description: This page (/admin/structure/types) lists all content types defined on your site.

Step 2: Edit the Desired Content Type

Find the content type for which you want to manage comment settings (e.g., ‘Article’). In its row, click the ‘Edit’ link from the operations dropdown or button.

Description: Each content type has an ‘Edit’ option.

Step 3: Access Comment Settings

On the content type edit form, scroll down to find the ‘Comment settings’ vertical tab or section. Click on it to expand the options.

Description: The content type edit form has several configuration sections, including ‘Comment settings’.

Step 4: Configure Default Comment Behavior

You will see a dropdown menu for ‘Default comment setting for new content’. Choose one of the following options:

  • Open: Comments are allowed. Users with permission can post comments.
  • Closed: Comments are not allowed. Existing comments (if any) might still be visible, but new comments cannot be added.
  • Hidden: Comments are not allowed, and existing comments are hidden.

Example: To enable comments by default on all new ‘Article’ nodes, select ‘Open’.

Description: This setting determines the initial comment status when new content of this type is created. Authors can often override this on individual nodes if they have permission.

Step 5: Additional Comment Options

Below the default setting, you might find other options:

  • Threading: Allows comments to be replies to other comments, creating discussion threads.
  • Comments per page: Sets how many comments are displayed per page if pagination is needed.
  • Anonymous commenting: If enabled in permissions, this setting might interact with whether anonymous users can post comments without logging in.
  • Comment form guidlines: Text to show above the comment form.

Step 6: Save Configuration

After making your changes, click the ‘Save content type’ button at the bottom of the form.

Overriding Comment Settings on Individual Nodes

Section titled “Overriding Comment Settings on Individual Nodes”

Even if a default comment setting is configured for a content type, content editors with the appropriate permissions can often override this setting on individual pieces of content (nodes) when creating or editing them. Look for a ‘Comment settings’ option on the node edit form.

Beyond content type settings, user permissions control who can perform comment-related actions. Navigate to ‘People’ > ‘Permissions’ (/admin/people/permissions) and look for the ‘Comment’ section. Here you can configure permissions such as:

  • Post comments: Allows users of a specific role to write and submit comments.
  • View comments: Allows users to see comments (usually granted to all).
  • Administer comments and comment settings: Allows moderating comments (approving, deleting) and changing settings.
  • Skip comment approval: Allows comments from certain roles to be published automatically without needing moderation.

By default, new comments might require approval by an administrator or moderator if the ‘Skip comment approval’ permission is not granted to the commenter’s role. Comments awaiting moderation can typically be found under ‘Content’ > ‘Comments’ (/admin/content/comment) in the ‘Unapproved comments’ tab.

For sites with public comments, spam can be an issue. Consider using contributed modules for spam protection, such as:

  • CAPTCHA / reCAPTCHA: Adds a challenge to the comment form to distinguish humans from bots.
  • Honeypot: Uses hidden form fields to trap bots.
  • Akismet: Integrates with the Akismet spam filtering service.

Practical Application: A news website enables comments on ‘Article’ content type to foster discussion. They configure comments to be ‘Open’ by default and grant ‘Post comments’ permission to authenticated users. They also install a CAPTCHA module to reduce spam.

Additional Resources: