title: Add comments to Custom node module
body: <p>In my custom module I would like to add the comments functionality. I've tried a couple of things but didn't workout so far.</p>
  
  <pre><code>// render comments form
  $output .= theme('my_module_front_page'); 
  $comment = new stdClass;
  $comment-&gt;nid = $node_good_practice-&gt;nid;
  $output .= render(drupal_get_form('comment_form', $comment));
  return $output;
  </code></pre>
  
  <p>The code above puts the comments form to my node page.</p>
  
  <p>But when I fill in the comment form and submit, it redirects me to this page: <code>comment/reply/node id</code> and then i have to fill in my comment all over again and the comment isn't saved.</p>
  
  <p>I would like to submit and stay on the same page instead of the redirect. And the comment must be saved after submitting.</p>
  
  <p>Right now, the comment form appears on my node page (custom module template). I enter a comment and click on "Save."
  I am sent to <code>/comment/reply/&lt;node_id&gt;</code>, but all the comment fields are empty. The comment isn't saved either.</p>
  
  <p>What I would like to happen is:</p>
  
  <ul>
  <li>Having a comment form on the node page</li>
  <li>Enter a comment</li>
  <li>Click on "Save"</li>
  <li>Drupal saves the comment, and redirect me back to the node/page I was viewing.</li>
  </ul>
  
  <h2>Things I've tried</h2>
  
  <ul>
  <li><p>Adding Redirect</p>
  
  <pre><code>$form['#redirect'] = "/success-stories/".$node_good_practice-&gt;good_practice_name."/".$node_good_practice-&gt;nid;
  </code></pre>
  
  <p>It did not change anything.</p></li>
  <li><p>Changing action</p>
  
  <pre><code>$form['#action'] = "/success-stories/".$node_good_practice-&gt;good_practice_name."/".$node_good_practice-&gt;nid;
  </code></pre>
  
  <p>It redirects me to <code>node/node_id/#comment-17</code></p></li>
  <li><p>Use <code>drupal_build_form()</code></p>
  
  <pre><code>$info-&gt;nid = $node_good_practice-&gt;nid;
  $comment['build_info']['args'][0] = $info;
  $comment['redirect'] = "http://www.google.nl";
  $output .= render(drupal_build_form('comment_form', $comment));
  </code></pre>
  
  <p>The form is being displayed, but it does not redirect; it is sent to <code>comment/reply/node_id</code>.</p></li>
  </ul>