You are here

function cleantalk_check_users_form_submit in Anti Spam by CleanTalk 7.4

Same name and namespace in other branches
  1. 7.5 src/Form/CleantalkCheckUsersForm.php \cleantalk_check_users_form_submit()

File

src/Form/CleantalkCheckUsersForm.php, line 109
CleanTalk module admin functions.

Code

function cleantalk_check_users_form_submit($form, &$form_state) {
  $action = $form_state['values']['cleantalk_spam_users_wrapper']['cleantalk_spam_users_table_actions'];
  $values = array();
  foreach ($form_state['values']['cleantalk_spam_users_wrapper']['cleantalk_spam_users_table'] as $key => $value) {
    if (is_string($value)) {
      $values[] = $form_state['complete form']['cleantalk_spam_users']['cleantalk_spam_users_wrapper']['cleantalk_spam_users_table']['#options'][$value];
    }
  }

  //Delete user
  if ($action == 1) {
    foreach ($values as $user) {
      user_cancel(array(), $user['#attributes']['user_id'], 'user_cancel_delete');
    }
  }
}