I want to get hold of the
nid of the newly created node whenever a new node or comment is created by a user by pressing "Save" (and only when the user press "Save" - not when the node is created or saved by other means).
I've tried to create a custom submit handler to intercept the save by means of a custom submit handler:
$form['#submit'] = 'mymodule_node_submit';
This handler intercepts the press on the "Save" button, but it is invoked too early. The
nid of the node it is not yet available inside the submit handler.
What is the correct way of getting the
nid whenever a new node is created by an interactive user?
I know there is a similar question here: Get node id of saved node - but the accepted solution (use
hook_node_update()) is not correct.
hook_node_update() will also intercept calls when nodes are created programatically (for instance by the Feeds module), when there is no real user involved.