Is it a bad idea to call node_save inside hook_insert? I have a custom content type; inside its hook_insert I do node_save on another custom content type. But I noticed that the original node (hook_insert) wasn't saved but the second node was (node_save). Is this a no-no? Or any workarounds?

Thanks

Comments

nevets’s picture

It would help to see the code you are using. A guess would be you are constructing another node using $node which would effectively wipe out the original node.

stodge’s picture

I think you might be right - I haven't had chance to look at it again, but I'll double check.

Thanks

danielb’s picture

use $newnode = drupal_clone($node); if you want a copy of the node