Rename settings related to user.module email notifications.

Related topics

File

modules/system/system.install, line 1535

Code

function system_update_6017() {
  $ret = array();

  // Maps old names to new ones.
  $var_names = array(
    'admin' => 'register_admin_created',
    'approval' => 'register_pending_approval',
    'welcome' => 'register_no_approval_required',
    'pass' => 'password_reset',
  );
  foreach ($var_names as $old => $new) {
    foreach (array(
      '_subject',
      '_body',
    ) as $suffix) {
      $old_name = 'user_mail_' . $old . $suffix;
      $new_name = 'user_mail_' . $new . $suffix;
      if ($old_val = variable_get($old_name, FALSE)) {
        variable_set($new_name, $old_val);
        variable_del($old_name);
        $ret[] = array(
          'success' => TRUE,
          'query' => "variable_set({$new_name})",
        );
        $ret[] = array(
          'success' => TRUE,
          'query' => "variable_del({$old_name})",
        );
        if ($old_name == 'user_mail_approval_body') {
          drupal_set_message('Saving an old value of the welcome message body for users that are pending administrator approval. However, you should consider modifying this text, since Drupal can now be configured to automatically notify users and send them their login information when their accounts are approved. See the <a href="' . url('admin/user/settings') . '">User settings</a> page for details.');
        }
      }
    }
  }
  return $ret;
}