function captcha_after_form_alter in CAPTCHA After 7
Same name and namespace in other branches
- 6 captcha_after.module \captcha_after_form_alter()
Implementation of hook_form_alter().
File
- ./
captcha_after.module, line 32 - Show CAPTCHA protection on selected forms after specified number of unsuccessful form submit attempts has been made.
Code
function captcha_after_form_alter(&$form, &$form_state, $form_id) {
// First check do we have captcha for this form.
module_load_include('inc', 'captcha');
$captcha_point = captcha_get_form_id_setting($form_id, TRUE);
if (!$captcha_point || $captcha_point == '' || $captcha_point == 'none') {
return;
}
// Load captcha after settings for this form.
$ca_settings = captcha_after_get_forms_settings($form_id);
// Check if captcha_after is enabled for this form.
if (!$ca_settings['enable']) {
return;
}
$form['#after_build'][] = 'captcha_after_form_after_build';
$form['#validate'][] = 'captcha_after_form_validate';
$form['#pre_render'][] = 'captcha_after_form_pre_render';
$form['#submit'][] = 'captcha_after_form_submit';
}