Here is a snippet that has worked for me, but by transforming the array into an object and then performing node_submit() and node_save():
... $node = (object)$node; $node = node_submit($node); node_save($node);
and the following snippet I know for sure correctly saves the uid:
$section_node = new stdClass(); $section_node->title = $org_name; ... $section_node->uid = $account->uid; $section_node = node_submit($section_node); node_save($section_node);
Victor Kane http://awebfactory.com.ar
On 5/29/07, Zohar Stolar z.stolar@gmail.com wrote:
I'm using drupal_execute() to save a CCK node.
I'm trying to save the node on behalf of a different user (different than the current user).
However, I don't manage to set the ownership of the node.
Was anyone able to do such a thing? This is how I try to do it:
$title = 'The node's ';
$name = 'usernameA'; // the owner ti be, not the current user
$uid = 23; // the user's uid
$node = array('type' => 'article', 'uid'=>$uid,'name'=>'$name');
drupal_execute('organization_node_form',array('title'=>$title,'op'=>'submit'),$node);
What I get is a node with an anonymous owner...
Thanks, Zohar -- [ Drupal support list | http://lists.drupal.org/ ]