function hook_update
7.x node.api.php | hook_update($node) |
6.x node.php | hook_update($node) |
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
4 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_form_update in drupal-6.x/
modules/ book/ book.pages.inc - Renders a new parent page select element when the book selection changes.
- locale_system_update in drupal-6.x/
modules/ locale/ locale.module - Imports translations when new modules or themes are installed or enabled.
- node_mass_update in drupal-6.x/
modules/ node/ node.admin.inc - Make mass update of nodes, changing all nodes in the $nodes array to update them with the field values in $updates.
- poll_update in drupal-6.x/
modules/ poll/ poll.module - Implementation of hook_update().
4 invocations of hook_update()
- node_type_save in drupal-6.x/
modules/ node/ node.module - Saves a node type to the database.
- taxonomy_save_vocabulary in drupal-6.x/
modules/ taxonomy/ taxonomy.module - update_check_requirements in drupal-6.x/
update.php - Check update requirements and report any errors.
- user_save in drupal-6.x/
modules/ user/ user.module - Save changes to a user account or add a new user.
File
- documentation-6.x/
developer/ hooks/ node.php, line 342 - 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);
}