The Node Comments module let you assign you own content type as comment. For example, i have the following two content types.
- Food
- Food Comment
Moreover, i also have a view which list out all the food comments for a specific food node id.
- food_comments
So i want to amend the post a comment form under the food_comments view. I did it by hook_views_pre_render().
function <module>_views_pre_render(&$view) {
if ($view->name == "food_comments") {
// Load the food node
$food = node_load(arg(1), NULL, TRUE);
// Render the post a comment form under list of food comments
if (function_exists('nodecomment_render') && $food->node_comment) {
$food->node_comment = NULL;
$view->attachment_after = nodecomment_render($food, $food->cid);
}
}
}
Done =)
Reference: Drupal Module – Node comments
