function user_update_7003

Update user settings for cancelling user accounts.

Prior to 7.x, users were not able to cancel their accounts. When administrators deleted an account, all contents were assigned to uid 0, which is the same as the 'user_cancel_reassign' method now.

Related topics

File

drupal/modules/user/user.install, line 557
Install, update and uninstall functions for the user module.

Code

function user_update_7003() {

  // Set the default account cancellation method.
  variable_set('user_cancel_method', 'user_cancel_reassign');

  // Re-assign notification setting.
  if ($setting = variable_get('user_mail_status_deleted_notify', FALSE)) {
    variable_set('user_mail_status_canceled_notify', $setting);
    variable_del('user_mail_status_deleted_notify');
  }

  // Re-assign "Account deleted" mail strings to "Account canceled" mail.
  if ($setting = variable_get('user_mail_status_deleted_subject', FALSE)) {
    variable_set('user_mail_status_canceled_subject', $setting);
    variable_del('user_mail_status_deleted_subject');
  }
  if ($setting = variable_get('user_mail_status_deleted_body', FALSE)) {
    variable_set('user_mail_status_canceled_body', $setting);
    variable_del('user_mail_status_deleted_body');
  }
}