Render comment edit form in block I am using following code to render node comment form in a block:

$comment_form = drupal_get_form('comment_node_&lt;node_type&gt;_form', (object) array('nid' =&gt; $nid));
print drupal_render($comment_form);


It is working fine.

Now I need to check if a user has already commented on the node. If the user has not commented than I will show him/her this comment add form.

But in case, the user has already placed a comment for the node, I want to show him/her the edit form for his/her comment, where he/she can make changes and save thus updating the existing comment instead of saving new.

Any suggestions?
I found a solution for this case, sharing so that anyone who need similar solution can use it.

Anyone who has similar issue can use the solution below:

&lt;?php       
    $comment = comment_load($comment_id); // $comment_id = cid of comment whose edit form need to be open

    module_load_include('inc', 'comment', 'comment.pages');
    $form = drupal_get_form('comment_form', $comment); 

    return drupal_render($form);
?&gt;