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...

saludos,

Victor Kane
http://awebfactory.com.ar

On Sat, Mar 8, 2008 at 4:21 PM, Steve Ringwood <nevets@mailbag.com> wrote:
In drupal 4.7 and 5.x I have found that

$node = node_submit($node);
node_save($node);

generally works.