I'm searching a module to clone several nodes automatically when i create a project node type. To explain better : When i create a new node of Project type for exemple, i need to clone some nodes and tie this nodes to my node project.
I have tried node_clone but we should use a button to clone the node. For the moment i developped a small code to clone my node like this :
$p1template=variable_get('myvar_p1'); $p1=node_load($p1template); unset($p1->nid); unset($p1->vid); $p1->title='Processus P1'.$projectid; $p1->field_px_projet['und']['target_id']=$projectid; node_save($p1);
But i had a second problem with the field_collection. when i cloned the nodes, the field_collection keep the same reference and when i modify a field collection, all the nodes cloned field_collection was modify...
How can i fix this problem ?
PS : Sorry for my english..