When a node is saved, I want to append the NID to the title of the node.
$node->title = "XYZ_" . $node->nid;
If I put this code inside hook_node_presave()
, it won't work because NID($node->nid
) is not available.
If I put this code inside hook_node_insert()
, NID ($node->nid
) is available but still won't work because we can't alter $node
values inside hook_node_insert()
as the transaction is already under way.
Is there a solution to this problem?