[development] create comment via drupal_form_submit() - possible?

Ken Rickard agentrickard at gmail.com
Sat Jan 29 03:31:30 UTC 2011


See

http://drupal.org/node/687584 

and at least three others. 


On Jan 28, 2011, at 9:06 PM, "David Cohen" <drupal at 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
> 


More information about the development mailing list