You are here

function userprotect_protected_users_delete_form_submit in User protect 6

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

Submit function for the delete confirmation form.

File

./userprotect.module, line 742

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_query("DELETE FROM {userprotect} WHERE uid = %d AND up_type = '%s'", $account->uid, $type);
  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/user/userprotect/{$admin_page}";
}