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():<br><br> ...<br> $node = (object)$node;<br> $node = node_submit($node);<br> node_save($node);
<br><br>and the following snippet I know for sure correctly saves the uid:<br><br> $section_node = new stdClass();<br> $section_node->title = $org_name;<br>...<br> $section_node->uid = $account->uid;<br>
$section_node = node_submit($section_node);<br> node_save($section_node);<br><br>Victor Kane<br><a href="http://awebfactory.com.ar">http://awebfactory.com.ar</a><br><br><div><span class="gmail_quote">On 5/29/07, <b class="gmail_sendername">
Zohar Stolar</b> <<a href="mailto:z.stolar@gmail.com">z.stolar@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm using drupal_execute() to save a CCK node.<br><br>I'm trying to save the node on behalf of a different user (different<br>than the current user).<br><br>However, I don't manage to set the ownership of the node.
<br><br><br>Was anyone able to do such a thing? This is how I try to do it:<br><br><br>$title = 'The node's ';<br><br>$name = 'usernameA'; // the owner ti be, not the current user<br><br>$uid = 23; // the user's uid
<br><br>$node = array('type' => 'article', 'uid'=>$uid,'name'=>'$name');<br>drupal_execute('organization_node_form',array('title'=>$title,'op'=>'submit'),$node);
<br><br><br>What I get is a node with an anonymous owner...<br><br><br>Thanks,<br>Zohar<br>--<br>[ Drupal support list | <a href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]<br></blockquote></div><br>