For more detail, see my argument on pp. 233-4 of Drupal 7 Module Development.
/me apologizes slightly for the shameless book plug. On Jan 28, 2011, at 9:06 PM, "David Cohen" <dru...@dave-cohen.com> wrote: > In D6, creating content via drupal_execute() was difficult. In D7 using > drupal_form_submit() seems even more so. Thanks to fields, I can't tell > how to pass in the body of a comment or node. > > Does anyone have an example snippet that creates a comment via > drupal_form_submit(). Or any other programmatic way? > > I'm building my comment during a cron job. I want the automatically > generated comment to be attributed to the Anonymous user. But, > anonymous does not have permission to "post comments", and > comment_form_submit() refuses to save the new comment unless > user_access('post comments'). I consider that a bug - that check is > made before showing the form and should not be made during submit. What > do you think? http://drupal.org/node/1044212 > > -Dave >