You are here

function user_expire_settings in User Expire 7

User expire admin settings form.

1 string reference to 'user_expire_settings'
user_expire_settings_page in ./user_expire.admin.inc
Page callback for the admin form.

File

./user_expire.admin.inc, line 67
Administrative pages for User expire module.

Code

function user_expire_settings($form, &$form_state) {

  // Get the rules and the roles.
  $rules = user_expire_get_role_rules();
  $roles = user_roles(TRUE);

  // Save the current roles for use in submit handler.
  $form['current_roles'] = array(
    '#type' => 'value',
    '#value' => $roles,
  );

  // Now show boxes for each role.
  $form['user_expire_roles'] = array(
    '#type' => 'fieldset',
    '#title' => t('User inactivity expire by role settings'),
    '#description' => t('Configure expiration of users by roles. Enter 0 to disable for the role. Enter 7776000 for 90 days.'),
  );
  foreach ($roles as $rid => $role) {
    $form['user_expire_roles']['user_expire_' . $rid] = array(
      '#type' => 'textfield',
      '#title' => t('Seconds of inactivity before expiring %role users', array(
        '%role' => $role,
      )),
      '#default_value' => isset($rules[$rid]->inactivity_period) ? $rules[$rid]->inactivity_period : 0,
    );
  }
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}