function cleantalk_check_users_form in Anti Spam by CleanTalk 7.4
Same name and namespace in other branches
- 7.5 src/Form/CleantalkCheckUsersForm.php \cleantalk_check_users_form()
Cleantalk check users form.
1 string reference to 'cleantalk_check_users_form'
- cleantalk_menu in ./
cleantalk.module - Implements hook_menu().
File
- src/
Form/ CleantalkCheckUsersForm.php, line 12 - CleanTalk module admin functions.
Code
function cleantalk_check_users_form($form, &$form_state) {
if (variable_get('cleantalk_authkey', '') != '') {
$rows = array();
$header = array(
'spam_user_name' => t('Name'),
'spam_user_email' => t('E-mail'),
'spam_user_created' => t('Created'),
'spam_user_status' => t('Status'),
);
if (!isset($form_state['offset'])) {
$form_state['offset'] = 0;
}
if (isset($form_state['spam_users'])) {
foreach ($form_state['spam_users'] as $spam_user) {
$rows[] = array(
'spam_user_name' => l($spam_user->name, 'user/' . $spam_user->uid),
'spam_user_email' => '<a target="_blank" href = "https://cleantalk.org/blacklists/' . $spam_user->mail . '">' . $spam_user->mail . '</a>',
'spam_user_created' => date("Y-m-d H:i:s", $spam_user->created),
'spam_user_status' => $spam_user->status == 1 ? 'Active' : 'Inactive',
'#attributes' => array(
'user_id' => $spam_user->uid,
'class' => array(
'cleantalk-spam-users-row',
),
),
);
}
}
$form['cleantalk_spam_users']['cleantalk_spam_users_wrapper'] = array(
'#type' => 'container',
'#tree' => TRUE,
'#prefix' => '<div id="cleantalk_spam_users_wrapper">',
'#suffix' => '</div>',
);
$form['cleantalk_spam_users']['cleantalk_spam_users_wrapper']['find_spam_users'] = array(
'#type' => 'submit',
'#value' => t('Find spam users'),
'#submit' => array(
'find_spam_users_btn',
),
'#ajax' => array(
'callback' => 'bulk_find_spam_users_callback',
'wrapper' => 'cleantalk_spam_users_wrapper',
),
);
$form['cleantalk_spam_users']['cleantalk_spam_users_wrapper']['cleantalk_spam_users_table_actions'] = array(
'#type' => 'select',
'#title' => t('Actions'),
'#options' => array(
1 => t('Delete'),
),
);
$form['cleantalk_spam_users']['cleantalk_spam_users_wrapper']['cleantalk_spam_users_table'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $rows,
'#empty' => t('No spam users found'),
'#attributes' => array(
'class' => array(
'cleantalk_spam_users_table',
),
),
);
$form['cleantalk_spam_users']['cleantalk_spam_users_wrapper']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
else {
drupal_set_message('Access key is not valid.', 'error');
}
}