Programmatically added comment form on node page doesn't work I have attached a view which displays comments to basic page content type using EVA module. I've also implemented the following to have the "add comment" form displayed just above the comments list:

/**
 * Implements hook_views_pre_build().
 */
function mymodule_views_pre_build(&amp;$view) {
  if ($view-&gt;name == 'page_comments') {
    if ($node = menu_get_object()) {
      $comment = new stdClass;
      $comment-&gt;nid = $node-&gt;nid;
      $form = drupal_get_form('comment_form', $comment);
      $form['#redirect'] = current_path() . '?page=' . (int)$_GET['page'];
      $header = drupal_render($form);
      $view-&gt;add_item('default', 'header', 'views', 'area', array('content' =&gt; $header, 'format' =&gt; 'full_html'));
    }
  }
}


It should work like this:


on page /node/12, which contains the node, comment list and the "add
comment" form, the user enters new comment and submits
the page reloads quickly
the submitted comment appears in the comment list on the same page,
together with another "add comment" form


What actually happens:


as above
user is redirected to page /comment/reply/12 which also contains the
node, comment list and the "add comment" form
however, the previously submitted comment is lost, it doesn't appear
in the database or anywhere else
the user can then again enter a comment and submit
if he does so, he is redirected to page /node/12#comment-1561, which
contains the node, comment list and the "add comment" form
the second submitted comment is on the comment list


So there are two problems with my added form: comment is not submitted and there is redirection. What needs to be done to make it work the way it should?
I'm not sure about the failure to submit, but drupal_get_form caches the form config, so making changes to the #redirect after calling it will be lost by the time the form submits. You'd need to use hook_form_alter for that change to persist.

As an alternative, you might consider the AJAX comments module. In theory that will work with a manually embedded comment form, and it'll sidestep your current issue while providing a slightly better UX for comments site-wide.