function hook_user_cancel


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 user.api.php hook_user_cancel($edit, $account, $method)
cle7 user.api.php hook_user_cancel($edit, $account, $method)
elmsmedia7 user.api.php hook_user_cancel($edit, $account, $method)
icor7 user.api.php hook_user_cancel($edit, $account, $method)
meedjum_blog7 user.api.php hook_user_cancel($edit, $account, $method)
mooc7 user.api.php hook_user_cancel($edit, $account, $method)

Act on user account cancellations.

This hook is invoked from user_cancel() before a user account is canceled. Depending on the account cancellation method, the module should either do nothing, unpublish content, or anonymize content. See user_cancel_methods() for the list of default account cancellation methods provided by User module. Modules may add further methods via hook_user_cancel_methods_alter().

This hook is NOT invoked for the 'user_cancel_delete' account cancellation method. To react on this method, implement hook_user_delete() instead.

Expensive operations should be added to the global account cancellation batch by using batch_set().


$edit: The array of form values submitted by the user.

$account: The user object on which the operation is being performed.

$method: The account cancellation method.

See also



Related topics

8 functions implement hook_user_cancel()

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

comment_user_cancel in modules/comment/comment.module
Implements hook_user_cancel().
entitycache_user_cancel in sites/all/modules/ulmus/entitycache/entitycache.module
Implements hook_user_cancel().
lti_tool_provider_memberships_user_cancel in sites/all/modules/ulmus/lti_tool_provider/lti_tool_provider_memberships/lti_tool_provider_memberships.module
Implements hook_user_cancel().
node_user_cancel in modules/node/node.module
Implements hook_user_cancel().
poll_user_cancel in modules/poll/poll.module
Implements hook_user_cancel().

... See full list

2 invocations of hook_user_cancel()
user_cancel in modules/user/user.module
Cancel a user account.
views_bulk_operations_user_cancel_action in sites/all/modules/ulmus/views_bulk_operations/actions/


modules/user/user.api.php, line 78
Hooks provided by the User module.


function hook_user_cancel($edit, $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':
      // Unpublish nodes (current revisions).
      module_load_include('inc', 'node', 'node.admin');
      $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
      node_mass_update($nodes, array('status' => 0));

    case 'user_cancel_reassign':
      // Anonymize nodes (current revisions).
      module_load_include('inc', 'node', 'node.admin');
      $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
      node_mass_update($nodes, array('uid' => 0));
      // Anonymize old revisions.
      db_update('node_revision')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute();
      // Clean history.
      db_delete('history')->condition('uid', $account->uid)->execute();



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.