function antispam_form_alter in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.module \antispam_form_alter()
Implements hook_form_alter().
File
- ./
antispam.module, line 1504 - Primary hook implementations for the Antispam module.
Code
function antispam_form_alter(&$form, &$form_state, $form_id) {
// Add anti-spam integration to webforms.
if (strpos($form_id, 'webform_client_form_') !== FALSE) {
$form['#validate'][] = 'antispam_webform_check';
}
if (!($form_id == 'user_register_form' || $form_id == 'user_profile_form')) {
return;
}
if (!variable_get('antispam_email_enabled', 1)) {
return;
}
$uid = $form['#user']->uid;
$antispam_moderator_email_for = isset($form['#user']->antispam_moderator_email_for) ? $form['#user']->antispam_moderator_email_for : 'approval';
$moderator_email_for_options = _antispam_get_email_for_options();
$moderator_types = antispam_get_moderator_types(NULL);
$moderator_types_count = count($moderator_types);
if (!$moderator_types_count) {
return;
}
$form['antispam_moderator'] = array(
'#type' => 'fieldset',
'#title' => t('AntiSpam moderator settings'),
'#weight' => 5,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => t('You are currently moderator for the following content types: %types.', array(
'%types' => implode(', ', $moderator_types),
)),
);
$form['antispam_moderator']['antispam_moderator_email_for'] = array(
'#type' => 'radios',
'#title' => t('Send me e-mails for'),
'#options' => $moderator_email_for_options,
'#default_value' => isset($moderator_email_for_options[$antispam_moderator_email_for]) ? $antispam_moderator_email_for : 'approval',
);
}