Drupal ships with flexible commenting functionality out of the box. Although there is a bit of a learning curve (as with many things in Drupal), once you understand the core concepts and how to manipulate the different features, you will be exposed to the power of managing comments within Drupal.

This tutorial will teach you how to manage comments in Drupal. We’ll cover the following:

  • Add comments within Drupal
  • Allow anonymous users to comment in Drupal
  • Moderate comments in Drupal
  • Create your custom comment type in Drupal

Drupal Comments vs External Comment Libraries (such as Disqus)

Before we dive right in, we must explain the differences between using Drupal comments and external comments. External comment plugins such as Disqus typically provide a JS library that you must load onto the pages on which you want the comments. These libraries can be upwards of 220KB just to load the Disqus comment widget (without any comments).

The following is a table listing some of the common differences. But do note that this list is not fully exhaustive.





You have full control of any fields, the design and layout. As your site grows, you can add/remove comment fields.

You must use the fields and layout provided by Disqus.


You have absolute control of your comments data and you will always own the data. The data is stored on your servers. This might be important to comply with privacy laws such as GDPR.

You must abide by Disqus’s terms and policies. Data is stored on Disqus’s servers. If you disconnect Disqus, your site loses all the comments immediately.


No need to load additional JS libraries on pages with comments. However, your database size will grow as you get more comments.

The Disqus libraries must be loaded, which can be a sizable amount. This will affect your page speed and load time. The amount of comments does not affect your site’s database size or performance.


You must implement your own measures to fight spam.

Mostly taken care of by default.

Ease of set up

There is a bit of a learning curve to set it up. Hopefully, this tutorial will help you with that.

Just drop the libraries into your site and you are quickly set up. Configuration can be done within the Disqus’s website.


You are ultimately responsible. As your site grows and you aggregate thousands of comments, you may need to optimize your database.

Provided by Disqus.

User Base

If you force users to register, you store their account information.

Disqus has a wide base of global users. Users will not need to register to comment on your site and they can use their existing Disqus profile.

Note: If you are interested in using Disqus, there is a Drupal Disqus module that may be useful.

How to decide if you should use Drupal comments vs external plugins such as Disqus?

If you have the Drupal skills and time (or budget), using Drupal comments would be a better option keeping in mind you have to set aside time/costs to moderate and maintain the comments in the future. Drupal comments do come with some long term planning and technical debt.

If you want a quick solution and are not skilled in Drupal or do not have a lot of time or money, a plugin like Disqus might be a cheap and fast solution.

There is no one correct answer. You will need to think deeply about the differences between both options and figure out the best one that applies to your use case.

The rest of this tutorial will dive into solely using Drupal to manage comments.

Add Comments to a Content Type in Drupal

By default, Drupal enables the core Comment module but you should check that this is enabled in your site.

Assuming the module is installed, let’s add comments to the Article content type.

1. Go to the “Manage Fields” of your content type: /admin/structure/types/manage/article/fields

2. Ensure the comment fields exist as shown in Figure 1. If it is not there, just add it by clicking on “Add field” and selecting “Comments”.

Manage fields page
Figure 1

3. Now if you go to one of your Article content, will see a link “Add new comment” as shown in Figure 2.

Figure 2

4. Clicking on this link allows you to add a comment as shown in Figure 3.

Comment form in Drupal
Figure 3

And the result looks like Figure 4.

Figure 4

Disable Comments on a node (content) in Drupal

Disabling comments on a per-node basis is quite easy.

First, find the node you want to disable the comments on and go to the edit screen of that node. Look for the “Comment Settings” section as shown in Figure 5.

Comment settings
Figure 5

Select “Closed” to show the previously published comments but lock the comments form from allowing new comments. See Figure 6 for how this will look. Notice there is no link to add a new comment.

Figure 6

Select “Hidden” to entirely hide all old comments and the comment form. Figure 7 shows how that would look.

Figure 7

Note: If you do not see the “Comments Settings” section in Step 1 above, go to the Manage Form Display tab of the content type and ensure the Comment field is enabled as shown in Figure 8.

Figure 8

Explanation of Drupal core’s Comment Field Settings

Drupal comment field ships with some default comment field settings which you can override. To see these comment field settings:

1. Go to the “Manage Fields” of your content type and click on edit next to the comment field as shown in Figure 9.

Figure 9

The comments field settings are shown in Figure 10 below. We will explain each of the highlighted sections in more details below.

Figure 10

Comment Threading

If this is enabled, comments are threaded. Figure 11 encapsulates how the threading works.

Figure 11

Comments per page

As the name suggests, this is the maximum number of comments shown on the page. After this maximum is reached, a second page and a pager will be added automatically. For demonstration purposes, we set this maximum value to 1 and captured the screenshot shown in Figure 12.

Figure 12

Comment Reply Form

If this is checked, the “add new comment” form is shown on the same page. If this is unchecked, the form is not shown and the user must click on “Add new comment” which will go to the subsequent page with the comment reply form. The unchecked option is shown in Figure 13.

Figure 13

Preview Comment

This field setting dictates whether you want to force the user to preview their comment before submission or not. If you select “Required”, the comment form will look as shown in Figure 14. Notice that there is no “Save” button to force the user to “Preview” the comment. You may want to enforce this setting in such cases where you want the user to double-check their comments before submission.

Figure 14

Allow Anonymous Users to Comment in Drupal

Allowing anonymous users to post comments is controlled by Drupal permissions. Here are the steps.

1. Go to admin/people/permissions
2. Under Anonymous User, select the checkbox for “Post comments” as shown in Figure 15.

Figure 15

3. Save and clear your cache.

Note: If you want the ability to moderate anonymous users’ comments, then make sure to uncheck “Skip comment approval” for anonymous users. If you want to moderate ALL comments across the site, uncheck “Skip comment approval” for all roles.

How to Moderate Comments in Drupal

Moderating comments is quite easy in Drupal once you know where to look for it.

First let’s allow anonymous users to post comments but their comments must require approval before publishing.

For this, check the box “Post comments” and uncheck “Skip comment approval” for anonymous users as shown in Figure 15 above.

Then post a comment as an anonymous user. Once you do this, you will notice this message at the top of the screen as shown in Figure 16.

Figure 16

Tip – If you want to alter the message “Your comment has been queued…”, you need to write a hook_form_alter and add a new submit handler.

Now, log in to your site as the administrator and go to: admin/content/comment/approval

Here you will see a listing of all pending comments to be approved. Here are the steps to publish the comment:

  1. Select the comment
  2. Select the “Publish comment” action from the drop down
  3. Click on “Apply to selected items”

These 3 steps are shown in Figure 17.

Figure 17

Note:  You can also edit the comment before publishing it. Sometimes anonymous users can make typographical errors or insert links that you may wish to edit first. You can allow other roles besides administrator to moderate comments. Simply assign the permission “Administer comments and comments settings” to the relevant role.

Create Custom Comment Type

Starting from Drupal 8, comments are now entities and that means you can attach fields to them just as you would to content types.

We will assume here that you already have a Video content type created (you can use any content type you wish). We will create a custom comment type in the next few steps and add it to our Video content type.

1. Go to admin/structure/comment and click on “Add comment type” as shown in Figure 18.

Figure 18

2. Give it a label and make sure to select “Content” under Target entity type as shown in Figure 19.

Figure 19

3. Then click on “Manage Fields” of your newly created comment type as shown in Figure 20.

Figure 20

4. A comment_body field is added by default. It is up to you to leave it or delete it as necessary. Let’s go ahead and leave it and create an additional field. We would like to add a dropdown field in our example. Click on “Add field” as shown in Figure 21.

Figure 21

5. Select List (text), add your options and click on “Save field settings” as shown in Figure 22.

Figure 22

6. This is an optional step. We have made our field “required” to show that you can customize this field just as you would any other Drupal field. You can make other customizations to this field as necessary (for e.g making the Label display inline under “Manage display”).

7. Now let’s go to the Video content type and add our new comment field. Go to the “Manage Fields” of the Video content type and click on “Add Field” as shown in Figure 23. Go to admin/structure/types/manage/video/fields

Figure 23

8. Select “Comments” and give it a relevant title as shown in Figure 24.

Figure 24

9. Under “Comment type” select the comment type that we created in Steps 1-5 above as shown in Figure 25. Click on “Save field settings”.

Figure 25

10. You will then be directed to the field settings page of the newly added comment type. You can adjust the settings on this page as needed. This page is shown in Figure 26.

Figure 26

Once you save, you can see that our custom comment field is added to our Video content type as seen below in Figure 27.

Figure 27

Click on “Manage form display” to ensure our comment field is enabled as shown in Figure 28.

Figure 28

Click on “Manage display” to ensure our comment field is enabled there also (see Figure 29 below).

Figure 29

At this point, we are done. Let’s add a new Video content to see how our comment form looks. See Figure 30.

Figure 30

And finally here is the output if we were to submit the comment. See Figure 31.

Figure 31

We can customize our comment with the exact fields that we want for our related Video content type. The sky’s the limit with how you can now customize comment types with fields that purposely fit your content type. This is really a genuine benefit of using Drupal comments instead of external commenting systems such as Disqus.

Dealing with Spam Comments

If your site gets traffic, you’ll start to receive spam comments. Luckily there are a few modules that can help manage this:


This tutorial has demonstrated how to manage comments within Drupal. We have highlighted some key differences between using Drupal core’s comment module versus external plugins such as Disqus and that you need to analyze your scenario in picking one over the other.

We have explained further how to add comments, allow anonymous users to comment, and moderate comments. Most importantly, we have shown the best feature of using Drupal comments: creating a custom comment type and attaching it to any content type.


Source link