Drupal snippet: moving node comments onto a block
**Update: ** Disregard what I said here, follow this instead: http://drupaleasy.com/blogs/ericmarden/2008/09/moving-comment-form-witho...
I decided to start documenting little bits of code for Drupal, so I could refer back to it when needed, and so I could have a little variety, as not everyone is interested in all the games I play. I hope this will be of some use to some of you.
I wanted to separate the comments section of my blog posts from the main content area because my layout's footer is perfect for it. But digging around for hooks / theme overrides got me nowhere. I resorted to hacking up some jQuery to grab the comments section,and prepend it to the footer. It worked well for the most part, but reCAPTCHA wouldn't play nice with this implementation.
I found out that the comments section was appended right after calling node_view, using the node_show function. The node_show function calls node_view, then adds in the comments, then updates the history tag table.
Now this is still a hack, and its arguably worse than the JS solution as it involves editing a core module. But I couldn't find anything to override this. Anyways, open up node.module, and find the node_show function. Comment out this bit of code.
if (function_exists('comment_render') && $node->comment) {
$output .= comment_render($node, $cid);
}
This should disable the comments for all nodes. Now go into Blocks and create a new block. Set the input filter to PHP code, and put this code on the block body (enclose it in php tags):
if(arg(0) == 'node' && is_numeric(arg(1))&& !arg(2)) {
$t_node = node_load(arg(1));
if (function_exists('comment_render') && $t_node->comment) {
print comment_render($t_node);
}
}
Save the block, and put it on your region of choice (mine's on content bottom), and you're done. The code should be self-explanatory. I haven't found any conflicts with this, reCAPTCHA works great now, and submitting, editing and deleting replies work just fine.
Of course this is still hackish, if anyone knows of a better way please let me know. :)

This solution doesn’t require hacking core: http://drupaleasy.com/blogs/ericmarden/2008/09/moving-comment-form-witho...
on May 06, 2009 10:16:23
Thanks matt :) That’s a fantastic workaround, no hacking required.
on May 27, 2009 20:51:19
Thanks :) you’re right the code areas are a little too small, i’ll fix that.
on July 08, 2009 22:54:41
Yeah, the node_Show function actually adds the comments and changes the tag. I did try doing the hack but to no avail. Would there be any othe rhacks that could be available for it? Changing your platform to something that could be helpful with Drupal is awesome! Way to go!
california sell house
on November 20, 2011 15:39:43
this module moves the comments into a block and even gives you the power of views to tweak the display http://drupal.org/project/commentsblock
on December 13, 2011 01:57:52
Thank you Matt, I’ve been looking how to do this. It works!
on February 26, 2012 06:37:30
Thanks matt :)
on March 05, 2012 07:05:19
With the ideas given in your sample article published here there would be hardly a student not able to finish a book report. Your critical thinking is fine with me, and I began writing customized essays
on March 06, 2012 14:35:27
great tips. i remember these fondly when gas was a dollar a gallon. i think that we probably shouldn’t fall back on these, but i think everyone will adopt a few of them Thanx admin
on March 09, 2012 16:25:02
Hello I have a few game site. y8 flash game sites, such as, for example such as this site has a few more. You enter these sites to look at my request. if you do not like him y3 friv site, for example my site has a quality look at onada. Recently, my daughter has one that he began on the first page in google, this is a really y8 nice feeling to release the first page on all my sites ura_1yorum. ben10 y8 or miniclip appeal to children more focused on sites with the style of a work there, but pogo, I have my sites, such as y8. Share it with friends using social networking sites or blog sites?. kizi them - y8 - sites such as y3 invite thank you very much.
to discuss
on March 09, 2012 16:25:38
Hi there,Really nice job,There are many people searching about that now they will find enough sources by your tips,Also looking forward for more tips about that ptc
on March 14, 2012 06:56:07
Very nice article on this website. It is rare these days to find websites with useful data . I am relieved I came upon this site. I will eagerly look forward to your incoming updates.Thanks for sharing it here
on March 15, 2012 12:58:21
I am very much pleased with the contents you have mentioned.I wanted to thank you for this great article. Interesting post and thanks for sharing. Some things in here I have not thought about before.Thanks for making such a cool post which is really very well written.
on March 17, 2012 03:39:48
Great work ! Your web-site has provided me much of the advice I wished .
on March 20, 2012 03:59:47
Thanks matt :)
on April 10, 2012 14:01:57
Thank You
on May 03, 2012 08:26:11
tskler guzel calısma gamesgames games games gamesgames andkon agames
on May 05, 2012 09:34:15
Herve Leger Herve Leger Gowns Herve Leger Dress Herve Leger Bandage Dress Christian Louboutin Ralph Lauren Shirts Ralph Lauren Polo Shirts Polo Shoes Ralph Lauren Polo Polo Shirt Oakley Flak Jacket Oakley Radar Oakley Frogskins Oakley Holbrook Oakley Sunglasses Ray Ban Cats Ray Ban Clubmaster Ray Ban Aviator Ray Ban Wayfarer Ray Ban Sunglasses Oakley Flak Jacket Oakley Polarized Oakley Jawbone Oakley Juliet Oakley M Frame Ray Ban Wayfarer Ray Ban Aviator Ray Ban 3025 Ray Ban 2140 Ray Ban 2132
on May 18, 2012 00:52:31
Post new comment