wpcf7_captcha_validation_filter
The Contact Form 7 wpcf7 captcha validation filter function.
Description
Parameters (2)
- 0. $result
- The result.
- 1. $tag
- The tag.
Usage
if ( !function_exists( 'wpcf7_captcha_validation_filter' ) ) { require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/really-simple-captcha.php'; } // The result. $result = null; // The tag. $tag = null; // NOTICE! Understand what this does before running. $result = wpcf7_captcha_validation_filter($result, $tag);
Defined (1)
The function is defined in the following location(s).
- /modules/really-simple-captcha.php
- function wpcf7_captcha_validation_filter( $result, $tag ) {
- $tag = new WPCF7_FormTag( $tag );
- $type = $tag->type;
- $name = $tag->name;
- $captchac = '_wpcf7_captcha_challenge_' . $name;
- $prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
- $response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
- $response = wpcf7_canonicalize( $response );
- if ( 0 == strlen( $prefix ) || ! wpcf7_check_captcha( $prefix, $response ) ) {
- $result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) );
- }
- if ( 0 != strlen( $prefix ) ) {
- wpcf7_remove_captcha( $prefix );
- }
- return $result;
- }