Error message
You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).function node_user_delete
Implements hook_user_delete().
File
-
modules/
node/ node.module, line 1832
Code
function node_user_delete ($account) {
// Delete nodes (current revisions).
// @todo Introduce node_mass_delete() or make node_mass_update() more flexible.
$nodes = db_select ('node', 'n')->fields ('n', array(
'nid',
))
->condition ('uid', $account->uid)
->execute ()
->fetchCol ();
node_delete_multiple ($nodes);
// Delete old revisions.
$revisions = db_query ('SELECT vid FROM {node_revision} WHERE uid = :uid', array(
':uid' => $account->uid,
))
->fetchCol ();
foreach ($revisions as $revision) {
node_revision_delete ($revision);
}
// Clean history.
db_delete ('history')->condition ('uid', $account->uid)
->execute ();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.