diff --git a/captcha/captcha.module b/captcha/captcha.module index 87124d0..04d339e 100644 --- a/captcha/captcha.module +++ b/captcha/captcha.module @@ -162,6 +162,7 @@ function captcha_element_info() { '#process' => array('captcha_element_process'), // The type of challenge: e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image', ... '#captcha_type' => 'default', + '#captcha_always' => FALSE, '#default_value' => '', // CAPTCHA in admin mode: presolve the CAPTCHA and always show it (despite previous successful responses). '#captcha_admin_mode' => FALSE, @@ -252,7 +253,7 @@ function captcha_element_process($element, &$form_state, $complete_form) { ); - if (_captcha_required_for_user($captcha_sid, $this_form_id) || $element['#captcha_admin_mode']) { + if (_captcha_required_for_user($captcha_sid, $this_form_id) || $element['#captcha_admin_mode'] || $element['#captcha_always']) { // Generate a CAPTCHA and its solution // (note that the CAPTCHA session ID is given as third argument). $captcha = module_invoke($captcha_type_module, 'captcha', 'generate', $captcha_type_challenge, $captcha_sid); @@ -650,7 +651,7 @@ function captcha_pre_render_process($element) { // of multi-page forms. Take previewing a node submission for example: // when the challenge is solved correctely on preview, the form is still // not completely submitted, but the CAPTCHA can be skipped. - if (_captcha_required_for_user($captcha_sid, $form_id) || $element['#captcha_admin_mode']) { + if (_captcha_required_for_user($captcha_sid, $form_id) || $element['#captcha_admin_mode'] || $element['#captcha_always']) { // Update captcha_sessions table: store the solution of the generated CAPTCHA. _captcha_update_captcha_session($captcha_sid, $captcha_info['solution']);