You are here

function autologout_form_alter in Automated Logout 6.3

Implementation of hook_form_alter().

File

./autologout.module, line 24
Used to automagically log out a user after a certain time.

Code

function autologout_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_admin_settings') {
    if (module_exists('jstimer')) {
      if (!module_exists('jst_timer')) {
        drupal_set_message(t('The "Widget: timer" module must also be enabled for the dynamic countdown to work in the automated logout block.'), 'error');
      }
      if (variable_get('jstimer_js_load_option', 0) != 1) {
        drupal_set_message(t('The Javascript timer module\'s "Javascript load options" setting should be set to "Every page" for the dynamic countdown to work in the automated logout block.'), 'error');
      }
    }
    $form['autologout'] = array(
      '#type' => 'fieldset',
      '#title' => t('Automated Logout'),
      '#weight' => -1,
    );
    $form['autologout']['autologout_seconds'] = array(
      '#type' => 'textfield',
      '#size' => 6,
      '#title' => t('Time until forced logout (seconds)'),
      '#description' => t('Force the user to logout after the given amount of time in seconds (0=disabled).'),
      '#default_value' => variable_get('autologout_seconds', 0),
    );
    $form['#validate'][] = 'autologout_form_validate';
    $form['#submit'][] = 'autologout_form_submit';
  }
}