add comment form in views I've created a views from comments. I want to have add comment form at the button of my views (in footer). so I installed "views_php" module and add "Global: PHP" to footer and write this code to print add comment form in footer.

$comment = new stdClass;
$comment-&gt;nid = $row-&gt;nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);


but the problem is that I don't have comment_body or any other custom field in the printed form. actually just author, subject and save button.

I tried this code too:

print drupal_render(drupal_get_form("comment_form", (object) array('nid' =&gt; $data-&gt;nid)));


or

print drupal_render(drupal_get_form("comment_node_news_form", (object) array('nid' =&gt; $results[0]-&gt;nid)));


but none of them worked properly!
&lt;?php
$comment = new stdClass;
$comment-&gt;nid = $row-&gt;nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);
?&gt;

Works for me. Make sure that your Content: Nid field is ABOVE the Global: PHP field, otherwise (when it's below it) $row-&gt;nid is not available as a variable.

Update
After reading your Q more carefully, since you want it in the footer then you need to specify the node id of the form. (Under what node this comment will be stored) For Example: /node/1
&lt;?php
$comment = new stdClass;
$comment-&gt;nid = 1;
$form = drupal_get_form('comment_form', $comment);
print render($form);
?&gt;

If you want /node/5 you change this line to $comment-&gt;nid = 5;
OR
If you want this to be dynamic, the nid to be based on the page you're viewing. Then use
&lt;?php
if ($node = menu_get_object()) {
$comment = new stdClass;
$comment-&gt;nid = $node-&gt;nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);
}
?&gt;

Note: The form will not render/show on views preview, but it will show up when you visit the node.