The "Log in or register to post comments" message does not display when there are no comments on a piece of content.

However, it does show when there is at least one comment.

Looking in the comment module code, the "Log in or register to post comments" message is in the code that only runs when there are already one or more comments!

How dumb is that?! Is there a module or an existing approach to making this display when there are no comments?

I can write a hook in my own module to override this but it might be re-inventing the wheel if it's already been done.

  • 2
    I have several Drupal 7 sites, and all of them show the "Log in or register to post comments" message when no comments are available. Have you customized your core? Have you set your permissions to allow anonymous comments? (If so, your users do not have to log in to comment.)
    – Triskelion
    Sep 9, 2013 at 17:07
  • +1 thanks Triskelion - I haven't customized the core. I will check your other suggestion though I am sure those permissions aren't set to allow anonymous comments as I would have seen a comment form on the page when not logged in - but this is not there. Thanks. I'll follow up. Sep 9, 2013 at 18:26
  • What theme are you using?
    – beth
    Sep 9, 2013 at 20:34
  • Beth - Bootstrap. I'm going to check there is nothing else going on and report back... thanks Sep 10, 2013 at 0:44

4 Answers 4


this is my temp solution.. i copy the ds-1col template to my ds-1col--node.tpl.php and add this code at bottom.

<?php global $user;
if (!$user->uid) {
print render($content['links']['comment']['#links']['comment_forbidden']['title']);
} ?> 
  • Thank you for this great solution. I'm using the latest Display Suite and it still has this issue, so your answer is very useful! Jun 2, 2014 at 8:03

The root cause was that Display Suite has not been set up correctly. Action for me is to do this, including appropriate CSS classes.

Because it wasn't setup, comments were not being displayed.

I was able to confirm this by simply switching off Display Suite - which meant that comments weren't managed though this.

I still want to use display suite but need to set it up OK.

Display Suite needs setting up

  • I've the very same issue but can't follow your answer. Is it possible to give us/me a step-by-step instruction to what you have done to get it working? Thx in advance :-). Aug 6, 2015 at 4:59

The solution in this link work for my https://groups.drupal.org/node/349753

  • 3
    Welcome to Drupal Answers :) Posts containing just a link to off-site resources aren't considered 'answers' as such here (if the link breaks the answer becomes useless). If you could edit the answer to summarise the solution, and provide the link s a supplement, that would be greatly appreciated. Thanks
    – Clive
    Oct 24, 2013 at 17:16

Here's another solution that might help someone: Copy the display suite template into your theme and in the bottom add this lines:

   <?php global $user;
    if (!$user->uid && $comment_count == 0) {
      print render($content['links']['comment']['#links']['comment_forbidden']['title']); 
    } ?> 

It's similar to the Willard answer, but if you don't add $comment_count == 0 in your code, you'll have duplicated links if there are already comments on the comment form.

Not the answer you're looking for? Browse other questions tagged or ask your own question.