When the user cannot create a comment and there are no comments on the node, the comment_wrapper is not called.

In my use case I have to display a request for an anonymous user to register / log in to comment as part of the block rather than in the nodes links as the output has specific requirements by the client.

To achieve this I added the following code to commentsblock_block_view()

        if (!$block['content']) {
          $block['content'] = theme('comment_wrapper',
            array(
              'theme_hook_original' => 'comment_wrapper__node_article',
              'theme_hook_suggestion' => 'comment_wrapper__node_article',
              'content' => array(
                '#node' => $node,
                'comments' => array(),
              ),
            )
          );
        }

Then I altered my comment_wrapper.tpl.php file to produce the required markup when $content['comment_form'] was empty.

CommentFileSizeAuthor
#2 commentsblock-2624298-2.patch848 bytesJohn Cook
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

John Cook created an issue. See original summary.

John Cook’s picture

FileSize
848 bytes

Added a patch file for the changes mentioned.