You are here

function logintoboggan_main_settings_submit in LoginToboggan 7

Takes custom settings on the main settings page, transforms them into the appropriate core setting, and cleans up the custom values.

1 string reference to 'logintoboggan_main_settings_submit'
logintoboggan_form_logintoboggan_main_settings_alter in ./logintoboggan.admin.inc
Implement hook_form_logintoboggan_main_settings_alter().

File

./logintoboggan.admin.inc, line 191
Administration functions for LoginToboggan module.

Code

function logintoboggan_main_settings_submit($form, &$form_state) {

  // User email verification setting.
  $user_email_verification = $form_state['values']['logintoboggan_user_email_verification'] ? FALSE : TRUE;
  variable_set('user_email_verification', $user_email_verification);
  unset($form_state['values']['logintoboggan_user_email_verification']);

  // Site 403 setting.
  $anon_403 =& $form_state['values']['logintoboggan_anon_403'];
  if ($anon_403 == '0') {
    $anon_403 = '';
  }
  if ($anon_403) {
    variable_set('site_403', 'toboggan/denied');
  }

  // If the unified login setting has been changed, we need to rebuild the
  // menu cache.
  if ($form['login']['logintoboggan_unified_login']['#default_value'] != $form['login']['logintoboggan_unified_login']['#value']) {
    drupal_set_message(t('Unified login setting was changed, menus have been rebuilt.'));

    // For some reason, a regular menu_rebuild() still leaves the old callbacks
    // cached -- doing it in a shutdown function seems to correct that issue.
    drupal_register_shutdown_function('menu_rebuild');
  }
}