You are here

function userprotect_protected_users_delete_form_submit in User protect 7

Same name and namespace in other branches
  1. 5 userprotect.module \userprotect_protected_users_delete_form_submit()
  2. 6 userprotect.module \userprotect_protected_users_delete_form_submit()

Submit function for the delete confirmation form.

File

./userprotect.admin.inc, line 294
Administration functions for userprotect module.

Code

function userprotect_protected_users_delete_form_submit($form, &$form_state) {
  $account = $form_state['userprotect']['account'];
  $type = $form_state['userprotect']['type'];
  $type_display = $form_state['userprotect']['type_display'];
  $admin_page = $form_state['userprotect']['admin_page'];
  db_delete('userprotect')
    ->condition('uid', $account->uid)
    ->condition('up_type', $type)
    ->execute();
  if ($type == 'user') {
    drupal_set_message(t('%user is no longer protected.', array(
      '%user' => $account->name,
    )));
  }
  elseif ($type == 'admin') {
    drupal_set_message(t('%user is no longer enabled for bypass.', array(
      '%user' => $account->name,
    )));
  }
  $form_state['redirect'] = "admin/config/people/userprotect/{$admin_page}";
}