function node_user_predelete

Implements hook_user_predelete().

File

drupal/core/modules/node/node.module, line 1466
The core module that allows content to be submitted to the site.

Code

function node_user_predelete($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);
  }
}