Hi all,
I'm developing a module with several table on Postgresql db.

My need now is a function that can duplicate a node (obviously with new nid and vid) with the pourpose to easly insert several records having already several fields filled in.

I'm wondering the best way to do it.

I evaluated the "just SQL" way and it seems possible but this way I need to insert the new node into "node" and node_revisions" table and also the session is involved.
So it seems not the best way.

Which way do you suggest? could you give me some indication?

thanks a lot

luca

Comments

ugerhard’s picture

You could try to node_load (http://api.drupal.org/api/function/node_load) the existing node, do whatever you want to do with the node object, unset its nid and then node_save the node (http://api.drupal.org/api/function/node_save).

lum12’s picture

Thank you!!.
I get it working well.

luca

--
luca marletta