-
AuthorPosts
-
June 7, 2018 at 1:44 pm #968756
Thank you for all your hard work on GDPR, Enfold is a great theme.
When the user fails to tick the privacy policy checkbox is there a way to target the error message to a “_blank page” or better still, how could I add a link to the error message taking the user back to the Comments page to tick the checkbox:
For example – Error: You must agree to our privacy policy…. Back to previous page.Many thanks.
June 9, 2018 at 9:02 pm #970547Hey Richard,
This is the default wordpress comment form validation function. You could install a plugin like: https://de.wordpress.org/plugins/wp-ajaxify-comments/ to validate the comments on the same page.
If you just want to edit the error message you can try to add this code to the child theme functions.php file:
add_filter('avf_privacy_comment_checkbox_error_message', 'avia_privacy_comment_checkbox_error_message', 10, 1); function avia_privacy_comment_checkbox_error_message($message) { $url = htmlspecialchars($_SERVER['HTTP_REFERER']); return "Error: You must agree to our privacy policy…. <a href='$url'>Back to previous page.</a>"; }
However I’m no sure if this code will work with the current theme version or if you must wait for the next theme update (because the filter “avf_privacy_comment_checkbox_error_message” might be missing in the current version).
Best regards,
DudeJune 12, 2018 at 8:41 pm #971821Hi Dude,
Thanks so much for your help, much appreciated. Your solution does partially work but you loose any comment on the ‘Return link’.
If you POST a comment without ticking the consent checkbox from the link (No. 1) you correctly get the error page with the Return link. Click the return link and this takes you back to an empty Comment page. Click the ‘Go back’ browser arrow (Chrome) and the page then displays the original comment. Is there a way to return to the page in one step with the comment so that it works the same way as your default setting on link No. 2.
Many thanks,
Richard.June 14, 2018 at 7:20 pm #972968Hi,
I didn’t test this code but you can try to use the javascript go back method like:add_filter('avf_privacy_comment_checkbox_error_message', 'avia_privacy_comment_checkbox_error_message', 10, 1); function avia_privacy_comment_checkbox_error_message($message) { return "Error: You must agree to our privacy policy…. <a href='#' onclick='window.history.back()'>Back to previous page.</a>"; }
Best regards,
DudeJune 14, 2018 at 11:55 pm #973025Hey Dude,
Many thanks for all your help, it works perfectly.
Best regards,
Richard.June 15, 2018 at 12:19 am #973038Hi,
I’m glad you were able to get this corrected. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Comment Form – Error: You must agree to our privacy policy…….Return Link?’ is closed to new replies.