e-Newsletter add a confirmation checkbox

I am preparing for the GDPR and this requires that a visitor who subscribes to our newsletter accepts our privacy statement.
I am using e-Newsletter, which has only 2 fields: name and email address. How to add a checkbox for this purpose, and how to include a link to our privacy statement?
This is mandatory as of 25 May... for everybody dealing with subscribers from Europe!

  • Adam Czajczyk

    Hi mpress

    I hope you're well today and thank you for your question.

    While our developers are working hard to make all our plugins GDPR compliant before the deadline, we have already reported this additionally.

    Meanwhile, with a bit of help of one of my SLS colleagues here, I came up with what might a workaround for you. I tested it on my end and it seems to be working fine.

    That said, I have attached a .zip file to this post. It contains a "enewsletter-add-privacy-box-js.php" file which is an MU plugin. After downloading and extracting the zip archive, please upload that .php file from inside it to the "/wp-content/mu-plugins" folder of your WP install.

    That should add a checkbox to the E-newsletter widget, along with an "I accept the Privacy Policy" message, with "privacy policy" being a link. If a user hits "subscribe" button without first checking the privacy policy checkbox, there's an alert displayed and the form is not processed. If the checkbox is checked, the form is processed as always.

    There are two things that you might want to adjust in the code though. In this line

    $('#add_member').append('<p><input type="checkbox" id="newsletter_privacy" name="newsletter_privacy" /> I accept the <a href="http://url_to_privacy.com" target="_blank">Privacy Policy</a></p>');

    you might probably want to change "I accept the Privacy Policy. As you can see it's just a text with a regular HTML link so you can change that text and set a link to point to your own Privacy Policy page on site.

    Then, in this line

    alert("If you don't accept Privacy Policy\nwe can't subscribe you!");

    that's a message that shows up if a checkbox is not checked so you might want to adjust it to. Note please: "\n" within the text stands for "new line" - it makes the message "wrap" and go to a new line at that point :slight_smile:

    I hope that helps :slight_smile:

    Please also keep an eye on this thread and on plugin's changelog upon updates as if the E-Newsletter update will include some code doing similar thing (for GDPR compliance) it might cause conflict so you will have to remove the mu-plugin that I shared here.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.