Secondary menu

Comments Not Showing Up in Drupal 7

nrussell's picture

Comments Not Showing Up in Drupal 7

Written by Nick Russell on

So you've enable comments on your content type, insured that it is set to Open, set the permissions up correctly but your comments still aren't showing up on the page, right?

There are a handful of reasons that could cause comments to not show up, from your template structure to any preprocessing conflicts. But the most common issue I've seen is actually pretty simple. If your content type was not set up to allow comments before you created content of that type, each piece of content you created inherited the comment settings. This means that when you enabled comments on your content type, none of the previously created content of that type allow comments on them.

How Do I Fix It?

If you have the patients, you can manually edit every piece of content that you've created and set the comments to Open. Or, why not take a slightly easier approach and run a quick little query?

  db_update("node")
    ->fields(array(
      'comment' => 2,
      ))
    ->condition("type", "node_type", "=")
    ->execute();

This code will update the node table and set all content of "node_type" to allow commenting. This is a quick a simple solution to get your comments working again on any content created without them.

No Responses Yet
Add a Response