Isn&#39;t there a need for node_submit() as well before node_save(); ?<br><br><div class="gmail_quote">On Fri, Oct 30, 2009 at 9:52 AM, Alex Barth <span dir="ltr">&lt;<a href="mailto:alex@developmentseed.org">alex@developmentseed.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
If speed is not an issue, use drupal_execute(). You&#39;re on the safe side with it, you don&#39;t need to worry about hook_nodeapi() / hook_form_alter() implementations of the moduls in use.<br>
<br>
Otherwise, I settled for:<br>
<br>
$node = new stdClass();<br>
node_object_prepare($node);<br>
// Add stuff.<br>
$node-&gt;title = &#39;my title&#39;;<br>
node_save($node);<br>
<br>
On that note, I urge all module developers to not rely on form submission in their hook_nodeapi() implementations. Your module&#39;s node api implementation shouldn&#39;t break when a node is being created without using the way through the form api.<div>
<div></div><div class="h5"><br>
<br>
On Oct 30, 2009, at 11:53 AM, Zhang Xiao wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have a batch of nodes need to be created from code, which function should i use as an entry?<br>
<br>
thanks!<br>
</blockquote>
<br></div></div><font color="#888888">
Alex Barth<br>
<a href="http://www.developmentseed.org/blog" target="_blank">http://www.developmentseed.org/blog</a><br>
tel (202) 250-3633<br>
<br>
<br>
<br>
<br>
</font></blockquote></div><br>