You are here

function foo_captcha_custom_validation in CAPTCHA 8

Custom CAPTCHA validation function.

Previous example shows the basic usage for custom validation with only a $solution and $response argument, which should be sufficient for most CAPTCHA modules. More advanced CAPTCHA modules can also use extra provided arguments $element and $form_state:

Parameters

string $solution: The solution for the challenge as reported by hook_captcha('generate',...).

string $response: The answer given by the user.

Return value

true on success and FALSE on failure.

1 string reference to 'foo_captcha_custom_validation'
foo_captcha_captcha in ./captcha.api.php
Implements hook_captcha().

File

./captcha.api.php, line 135
Hooks for the captcha module.

Code

function foo_captcha_custom_validation($solution, $response) {
  return $response == "foo" || $response == "bar";
}