node_user_cancel($edit, $account, $method)
Implements hook_user_cancel().
function node_user_cancel($edit, $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': // Unpublish nodes (current revisions). $nids = \Drupal::entityQuery('node') ->condition('uid', $account->id()) ->execute(); module_load_include('inc', 'node', 'node.admin'); node_mass_update($nids, array('status' => 0), NULL, TRUE); break; case 'user_cancel_reassign': // Anonymize all of the nodes for this old account. module_load_include('inc', 'node', 'node.admin'); $vids = \Drupal::entityManager()->getStorage('node')->userRevisionIds($account); node_mass_update($vids, array( 'uid' => 0, 'revision_uid' => 0, ), NULL, TRUE, TRUE); break; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!node!node.module/function/node_user_cancel/8.1.x