On Mon, Mar 10, 2008 at 10:16 AM, Earnie Boyd <<a href="mailto:earnie@users.sourceforge.net">earnie@users.sourceforge.net</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Quoting Victor Kane <<a href="mailto:victorkane@gmail.com">victorkane@gmail.com</a>>:<br>
<br>
> I do this a lot, so I will ad my two cents.<br>
><br>
> The following line is absolutely essential for "good housekeeping",<br>
> especially if you are using cck fields:<br>
><br>
> $node = node_submit($node);<br>
><br>
> However, it will NOT work if ... it shouldn't; for example if you omit (as<br>
> does the above code) initializing the uid attribute.<br>
><br>
<br>
</div>Which is what <a href="http://api.drupal.org/api/function/node_object_prepare" target="_blank">http://api.drupal.org/api/function/node_object_prepare</a><br>
does when nid is not set in the node object.</blockquote><div><br>OK, great. But I thought I read KarenS stating somewhere that the node_submit($node) was good when we are dealing with CCK fields... would be good to know<br>
<br>Victor<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<div class="Ih2E3d"><br>
> So, use this function, and include all the necessary fields to make it work,<br>
> it is a good test.<br>
><br>
> Larry is right, what is needed is a better solution...<br>
><br>
<br>
</div>mymodule_nodeapi? Filter on ``presave'' value for $op? Then the main<br>
code just does the node_save.<br>
<br>
<br>
Earnie -- <a href="http://for-my-kids.com/" target="_blank">http://for-my-kids.com/</a><br>
-- <a href="http://give-me-an-offer.com/" target="_blank">http://give-me-an-offer.com/</a><br>
<br>
</blockquote></div><br>