| Versions | |
|---|---|
| 7 | hook_node_insert($node) |
Respond to creation of a new node.
This hook is invoked from node_save() after the node is inserted into the node table in the database, after the type-specific hook_insert() is invoked, and after field_attach_insert() is called.
$node The node that is being created.
drupal/
<?php
function hook_node_insert($node) {
db_insert('mytable')
->fields(array(
'nid' => $node->nid,
'extra' => $node->extra,
))
->execute();
}
?>