Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.

    #970547

    Hey 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,
    Dude

    #971821

    Hi 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.

    #972968

    Hi,
    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,
    Dude

    #973025

    Hey Dude,
    Many thanks for all your help, it works perfectly.
    Best regards,
    Richard.

    #973038

    Hi,

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Comment Form – Error: You must agree to our privacy policy…….Return Link?’ is closed to new replies.