[ad_1]
Maybe try this?
<?php echo do_shortcode( '[hcaptcha auto="true"]' ); ?>- This reply was modified 12 hours, 3 minutes ago by joneiseman.
Thanks for your hint. The result is the same as before. The captcha is not a mandatory field…
Here is, how I solved the problem.
Add hCaptcha to the booking form:
<?php echo do_shortcode( '[hcaptcha]' ); ?>Add validation into function.php:
function em_validate($result, $EM_Event){
$captcha_result = null;
$captcha_result = hcaptcha_verify_post();
if ( null !== $captcha_result ) {
$EM_Event->add_error('Bitte löse das Captcha-Rätsel.');
$result = false;
}
if (!is_user_logged_in() && $_REQUEST['user_name'] == ''){
$EM_Event->add_error('Bitte gib deinen Namen an.');
$result = false;
}
if (!is_user_logged_in() && $_REQUEST['user_email'] == ''){
$EM_Event->add_error('Bitte gib deine E-Mailadresse an.');
$result = false;
}
return $result;
}
add_filter('em_booking_validate','em_validate', 1, 2);I hope, this will help others to protect the booking form against spam submissions.
Have fun!
Heiko
