IMO, any access check in a validate or submit is a bug because they break form_alter and programmatic submissions. And I'm pretty sure I opened an issue to that effect. I just need to find that issue. But it's late and I'm ranting via phone. On Jan 28, 2011, at 9:06 PM, "David Cohen" <drupal@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