How to move the comments on node display

Submitted by Michelle on Thu, 12/13/2007 - 22:44

Now that Fivestar has the ability to add rating to comments, I decided to switch from the way I was doing rate and review to using comments for reviews. But I have my nodes heavily themed including parcelling out bits into tabs and reviews are one of those bits. I didn't want them stuck down where the comments normally go.

Searching brought me to this thread on drupal.org which claimed it was impossible without hacking core. Well, I've gone 2.5 years without hacking core and wasn't about to start. After some discussion on IRC, litwol came up with the idea of clearing out $node->comment to keep the core function from doing its thing. That was the bit I needed to make this work.

So, to move the comments, just put this snippit where you want the comments to show up in your node-TYPE.tpl.php:

<?php
if (function_exists('comment_render') && $node->comment) {
   print
comment_render($node, $node->cid);
  
$node->comment = NULL;
}
?>