Active
Project:
Comment block
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Jun 2011 at 16:00 UTC
Updated:
23 Jun 2011 at 16:00 UTC
This is a very nice module to use with Quick tabs. In my application I have the comment form block in one tab and the comments view in another tab.
I don't see the need that each node type to have a comment block on it's own. I changed the code so that the comment block can used generically for any node type.
/**
* Implementation of hook_block().
*/
function commentblock_block($op, $delta = NULL, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t("Comment form block");
return $blocks;
case 'view':
$block = array();
if (user_access('post comments')) {
$node = menu_get_object('node');
// Only nodes dressed in page view are invited to this party.
if ($node->nid) {
// Only display the form if we are allowed to post comments.
// Note that this works because this function is called before the
// 'view' operation in hook_nodeapi().
if ($node->comment > COMMENT_NODE_READ_ONLY) {
$block['subject'] = t('Leave a comment');
$block['content'] = drupal_get_form('comment_form', array('nid' => $node->nid));
}
}
}
return $block;
}
}
I did not post this a a patch, as it is more like a feature request.