You are here

function user_expire_settings_submit in User Expire 7

Submit handler for user expire settings.

File

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

Code

function user_expire_settings_submit($form, &$form_state) {

  // Start with a beginner's mind.
  db_truncate('user_expire_roles')
    ->execute();

  // Insert the rows that were inserted.
  foreach ($form_state['values']['current_roles'] as $rid => $role) {

    // Only save non-zero values.
    if (!empty($form_state['values']['user_expire_' . $rid])) {
      db_insert('user_expire_roles')
        ->fields(array(
        'rid',
        'inactivity_period',
      ))
        ->values(array(
        'rid' => $rid,
        'inactivity_period' => (int) $form_state['values']['user_expire_' . $rid],
      ))
        ->execute();
    }
  }
}