give_checkout_error_checks stops donation
-
Using custom field validation code as was given in this page, https://givewp.com/documentation/developers/how-to-create-custom-form-fields/ , I have been able to adequately verify my custom field.
But, once the validation happens, the user is delivered back to the form page in WP.
The validation code has a simple return statement when validated.
function give_validate_recaptcha( $valid_data, $data ) { $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify'; $recaptcha_secret_key = 'xxx_secret_xxx'; $recaptcha_response = file_get_contents($recaptcha_url . "?secret=" . $recaptcha_secret_key . "&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']); $recaptcha_data = json_decode($recaptcha_response); if(isset($recaptcha_data->success) AND $recaptcha_data->success == true) { return; } else { give_set_error( 'g-recaptcha-response', __( 'Please verify that you are not a robot.', 'give' ) ); } } add_action( 'give_checkout_error_checks', 'give_validate_recaptcha', 10, 2 );
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘give_checkout_error_checks stops donation’ is closed to new replies.