You are here

function autologout_form_user_profile_form_alter in Automated Logout 6.4

Same name and namespace in other branches
  1. 7.2 autologout.module \autologout_form_user_profile_form_alter()
  2. 7.4 autologout.module \autologout_form_user_profile_form_alter()

Adds a field to user/edit to change that users logout.

File

./autologout.module, line 275
Used to automagically log out a user after a preset time.

Code

function autologout_form_user_profile_form_alter(&$form, $form_state) {
  $user_timeout = _autologout_get_user_timeout();
  global $user;
  $current_uid = $user->uid;
  $userid = $form['#uid'];
  $access = FALSE;
  if (user_access('change own logout threshold') && $current_uid == $userid || user_access('auto administer autologout')) {
    $access = TRUE;
  }
  if ($access) {
    $form['autologout_user_' . $userid] = array(
      '#type' => 'textfield',
      '#title' => t('Your current logout threshold'),
      '#default_value' => variable_get('autologout_user_' . $userid, ""),
      '#size' => 8,
      '#description' => t('How many seconds to give a user to respond to the logout dialog before ending their session.'),
      '#element_validate' => array(
        '_autologout_user_uid_timeout_validate',
      ),
    );
    $form['#submit'][] = 'autologout_user_profile_submit';
  }
}