1

I want a function/hook to be called at a point just when my custom node type is saved, I want to get the generated node id in that function, as I have to perform some operations based on nid.

I know one solution is which form alter hook is defined and I give a custom submit function to it and that function is called just when form is submitted, but in that case node is not yet saved at that point so there is no nid.

4
  • Can you specify Drupal version?
    – Codium
    Jul 10 '12 at 18:47
  • its drupal 7, sorry for late mentioning
    – Firdous
    Jul 10 '12 at 18:52
  • So just google for D7 equivalent of db_last_insert_id
    – Codium
    Jul 10 '12 at 18:55
  • but the point is where would i call this db_last_insert_id, I need a hook function for that which is called after the node submit
    – Firdous
    Jul 10 '12 at 18:58
1

You can use hook_node_update().

In Drupal 6, you can easily get the last node ID by calling db_last_insert_id().

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.