Modify a node, when another node is being saved?

77 Views Asked by At

How to modify another node, when another node is being saved?

i.e can I use a node_save($nid_to_be_saved) in side a hook_node_presave($node_being_saved)?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use node_save in hook_node_presave provided the node that is being saved is not saved again. If you want to do that you need to have a flag in the node object $node->presave_saved = TRUE; and do not save again to avoid loops.