2

I am not sure how to do this; I want to manually submit a comment.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Navane
  • 1,348
  • 2
  • 12
  • 25

2 Answers2

1

If you are using Drupal 6, you'll want to take a look at both comment_form_submit() and comment_save(). For Drupal 7, comment_save() is much more of a true API function, so if you are properly preparing your comment, that's all you should need.

jhedstrom
  • 3,378
  • 1
  • 23
  • 19
0
      $user = user_load(array(uid => $a_uid));
      $forum_comment_fields = array();
      $forum_comment_fields['values']['author']    = $user->name;
      $forum_comment_fields['values']['subject']   = "";
      $forum_comment_fields['values']['comment']   = $comment;
      $forum_comment_fields['values']['op']        = t('Save');
      $forum_comment_fields['values']['nid']       = $nid;
      $forum_comment_fields['values']['date'] = $created;
      comment_form_submit("comment_form", $forum_comment_fields);

I think the date is incorrect...

James
  • 477
  • 4
  • 6