You are here

function role_expire_user_admin_role_submit in Role Expire 7

Same name and namespace in other branches
  1. 8 role_expire.module \role_expire_user_admin_role_submit()
  2. 6 role_expire.module \role_expire_user_admin_role_submit()
  3. 2.x role_expire.module \role_expire_user_admin_role_submit()

Form submit handler invoked by role_expire_form_user_admin_role_alter. Updates default duration in database.

1 string reference to 'role_expire_user_admin_role_submit'
role_expire_form_user_admin_role_alter in ./role_expire.module
Implements hook_form_FORM-ID_alter().

File

./role_expire.module, line 373
Role Expire module

Code

function role_expire_user_admin_role_submit($form, &$form_state) {

  // If the role is being deleted, delete the default duration.
  // OR, if the new default duration is blank (empty), delete the default duration.
  if ($form_state['values']['op'] == t('Delete role') || empty($form_state['values']['role_expire'])) {
    role_expire_delete_default_duration($form_state['values']['rid']);
  }
  elseif ($form_state['values']['op'] == t('Save role')) {

    // Set the default duration to what's specified.
    role_expire_set_default_duration($form_state['values']['rid'], $form_state['values']['role_expire']);
    drupal_set_message('New default role expiration set.');
  }
}