Here's the situation:
My module allows users to select which node types get some extra fields. The information from those fields should be stored in a table created by my module. The table uses node id as primary key, because each node can appear only once in there, and all data in that table's dependant on that node.
The fields are added using hook_form_api. I also set custom validation and submit functions to process the fields.
Right now, the fields are there when they have to. Validation goes just fine, too. The submit function gets all the data it needs without a problem.
And that's where the problem appears. I got all the data that's filled in, so I can insert it into that table... if only I had the node ID! I don't, however, and I can't find a way to get it.
My guess is that the custom submit functions're called before the node's inserted into the database, meaning it doesn't have a node ID yet.
That makes the problem so tricky. If the node's inserted after all custom submit functions've been handled, there's no way I can get the required node ID there. Another possibility I see, is using a hook or such that gets called right after a node's been submitted. The problem with that, though, is that I don't know if such a thing exists (can't find anything 'bout it).
So does anybody here happen to know how I can get both submitted data and created node ID right after the user submits a new node?
Comments
.
Nevermind, was a very stupid question (yes, they exist!). Was thinking too far into the FAPI, but instead, I can just do this with hook_nodeapi. Works like a charm that way.