You are here

function logintoboggan_update_6000 in LoginToboggan 6

File

./logintoboggan.install, line 111

Code

function logintoboggan_update_6000() {

  // This one no longer exists.
  variable_del('reg_passwd_set');

  // Build defaults for existing variables.
  $defaults = array(
    'toboggan_block_type' => 0,
    'toboggan_block_msg' => '',
    'login_with_mail' => 0,
    'email_reg_confirm' => 0,
    'toboggan_role' => DRUPAL_AUTHENTICATED_RID,
    'toboggan_redirect_on_register' => '',
    'toboggan_redirect_on_confirm' => '',
    'login_successful' => 0,
    'toboggan_min_pass_length' => 0,
  );

  // Rename poorly named variables. Note that we're not renaming
  // 'logintoboggan_immediate_login_on_register' here, as that variable
  // name is ok.
  $variables = array(
    'toboggan_block_type' => 'logintoboggan_login_block_type',
    'toboggan_block_msg' => 'logintoboggan_login_block_message',
    'login_with_mail' => 'logintoboggan_login_with_email',
    'email_reg_confirm' => 'logintoboggan_confirm_email_at_registration',
    'toboggan_role' => 'logintoboggan_pre_auth_role',
    'toboggan_redirect_on_register' => 'logintoboggan_redirect_on_register',
    'toboggan_redirect_on_confirm' => 'logintoboggan_redirect_on_confirm',
    'login_successful' => 'logintoboggan_login_successful_message',
    'toboggan_min_pass_length' => 'logintoboggan_minimum_password_length',
  );
  foreach ($variables as $old_name => $new_name) {
    $value = variable_get($old_name, $defaults[$old_name]);
    variable_set($new_name, $value);
    variable_del($old_name);
  }
  return array();
}