You are here

function persistent_login_admin_settings in Persistent Login 6

Same name and namespace in other branches
  1. 5 persistent_login.module \persistent_login_admin_settings()
  2. 7 persistent_login.pages.inc \persistent_login_admin_settings()

Module settings form.

1 string reference to 'persistent_login_admin_settings'
persistent_login_menu in ./persistent_login.module
Implementation of hook_menu().

File

./persistent_login.pages.inc, line 11
Implementation of Persistent Login forms.

Code

function persistent_login_admin_settings() {
  $form = array();
  if (ini_get('session.cookie_lifetime') > 0) {
    drupal_set_message(_persistent_login_get_config_warning_msg(), 'error');
  }
  $form['persistent_login_welcome'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show welcome message on persistent login.'),
    '#default_value' => variable_get('persistent_login_welcome', TRUE),
    '#description' => t('If checked, the message \'Welcome back, <em>username</em>\' will be displayed each time a new login session is created via a Persistent Login cookie.'),
  );
  $form['persistent_login_maxlife'] = array(
    '#type' => 'textfield',
    '#title' => t('Days to remember the user'),
    '#size' => 10,
    '#maxlength' => 10,
    '#default_value' => variable_get('persistent_login_maxlife', PERSISTENT_LOGIN_MAXLIFE),
    '#description' => t('The maximum number of days for which a persistent login session is valid; afterwards, the user will need to log in again.  Enter 0 for no expiration.'),
  );
  $form['persistent_login_maxlogins'] = array(
    '#type' => 'select',
    '#title' => t('Remembered logins per user'),
    '#default_value' => variable_get('persistent_login_maxlogins', 10),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      15,
      20,
      25,
      30,
      35,
      40,
      45,
      50,
      60,
      70,
      80,
      90,
      100,
    )),
    '#description' => t('The maximum number of Persistent Logins remembered per user.'),
  );
  $form['persistent_login_cookie_prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Cookie name prefix'),
    '#size' => 40,
    '#maxlength' => 40,
    '#default_value' => variable_get('persistent_login_cookie_prefix', 'PERSISTENT_LOGIN_'),
    '#description' => t('A string used as prefix to build the persistent login cookie name. Characters allowed: ASCII letters ([A-Z], [a-z]), digits ([0-9]), hyphens ("-") or underscores ("_"). Previous cookies stored in user browsers will be lost when changing this value.'),
  );
  $form['persistent_login_secure'] = array(
    '#type' => 'radios',
    '#title' => t('Pages which require an explicit login'),
    '#default_value' => variable_get('persistent_login_secure', 1),
    '#options' => array(
      t('Every page except the listed pages.'),
      t('Only the listed pages.'),
    ),
  );
  $form['persistent_login_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('persistent_login_pages', PERSISTENT_LOGIN_SECURE_PATHS),
    '#cols' => 40,
    '#rows' => 5,
    '#description' => t("Enter one page per line as Drupal paths.  The '*' character is a wildcard.  Example paths are '<em>blog</em>' for the blog page, '<em>blog/*</em>' for every personal blog, and '<em>blog*</em>' for both. '<em>&lt;front&gt;</em>' is the front page."),
  );
  $form['persistent_login_history'] = array(
    '#type' => 'textfield',
    '#title' => t('Days to keep a log of persistent login actions'),
    '#default_value' => variable_get('persistent_login_history', 0),
    '#size' => 4,
    '#maxlength' => 10,
    '#description' => t('The number of days to keep an entry in the persistent_login_history table for each time a login is invalidated, including when a user logs in.  Entering 0 will disable logging.  This setting is intended for debugging purposes.'),
  );
  $form['#validate'] = array(
    'persistent_login_admin_settings_validate',
  );
  return system_settings_form($form);
}