You are here

function session_limit_user_settings_submit in Session Limit 7.2

Same name and namespace in other branches
  1. 6.2 session_limit.module \session_limit_user_settings_submit()
  2. 6 session_limit.module \session_limit_user_settings_submit()

Session limit user settings form submission.

File

./session_limit.module, line 410
Limits multiple sessions per user.

Code

function session_limit_user_settings_submit($form, &$form_state) {
  watchdog('session_limit', 'Maximum sessions for @user updated to @count.', array(
    '@user' => $form_state['values']['account']->name,
    '@count' => $form_state['values']['session_limit'],
  ), WATCHDOG_INFO, l(t('view'), "user/{$form_state['values']['account']->uid}"));
  if (empty($form_state['values']['session_limit'])) {
    $form_state['values']['session_limit'] = NULL;
  }
  if ($form_state['values']['account']->uid == 1) {
    variable_set('session_limit_include_root_user', !empty($form_state['values']['session_limit_include_root_user']));
  }
  user_save($form_state['values']['account'], array(
    'data' => array(
      'session_limit' => $form_state['values']['session_limit'],
    ),
  ));
  drupal_set_message(t('Session limit updated for %user.', array(
    '%user' => $form_state['values']['account']->name,
  )), 'status', TRUE);
}