[support] Saving a node with drupal_execute - changing node's owner

Zohar Stolar z.stolar at gmail.com
Tue May 29 10:33:08 UTC 2007


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


More information about the support mailing list