[development] programmatic creation of node

Victor Kane victorkane at gmail.com
Sat Mar 8 21:19:13 UTC 2008

I do this a lot, so I will ad my two cents.

The following line is absolutely essential for "good housekeeping",
especially if you are using cck fields:

$node = node_submit($node);

However, it will NOT work if ... it shouldn't; for example if you omit (as
does the above code) initializing the uid attribute.

So, use this function, and include all the necessary fields to make it work,
it is a good test.

Larry is right, what is needed is a better solution...


Victor Kane

On Sat, Mar 8, 2008 at 4:21 PM, Steve Ringwood <nevets at mailbag.com> wrote:

> In drupal 4.7 and 5.x I have found that
> $node = node_submit($node);
> node_save($node);
> generally works.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080308/9105f078/attachment.htm 

More information about the development mailing list