Same name and namespace in other branches
  1. 4.7.x developer/hooks/node.php \hook_update()
  2. 5.x developer/hooks/node.php \hook_update()
  3. 6.x developer/hooks/node.php \hook_update()
  4. 7.x modules/node/node.api.php \hook_update()

Respond to node updating.

This is a hook used by node modules. It is called to allow the module to take action when an edited node is being updated in the database by, for example, updating information in related tables.

Parameters

$node: The node being updated.

Return value

None.

To take action when nodes of any type are updated (not just nodes of the type(s) defined by this module), use hook_nodeapi() instead.

For a detailed usage example, see node_example.module.

Related topics

5 functions implement hook_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_update in modules/book.module
Implementation of hook_update().
fileupload_update in developer/examples/fileupload.module
forum_update in modules/forum.module
Implementation of hook_update().
node_example_update in developer/examples/node_example.module
Implementation of hook_update().
poll_update in modules/poll.module
Implementation of hook_update().
1 invocation of hook_update()
user_save in modules/user.module
Save changes to a user account.

File

developer/hooks/node.php, line 226
These hooks are defined by node modules, modules that define a new kind of node.

Code

function hook_update($node) {
  db_query("UPDATE {mytable} SET extra = '%s' WHERE nid = %d", $node->extra, $node->nid);
}