How to use the double opt-in for Contact Form 7 (v2.11)

With our plugin Forge12 Double-Opt-in for Contact Form 7 you extend the Contact Form 7 WordPress plugin with an additional opt-in system (DOI).

For this, only a few simple steps are needed to convert your form(s) to WordPress forms.

YouTube

Mit dem Laden des Videos akzeptieren Sie die Datenschutzerklärung von YouTube.
Mehr erfahren

Video laden

Install Double-Opt-in Plugin #

First, the plugin must be installed via the WordPress Plugin Manager. To do this, simply go to the backend of your WordPress website to the Plugins’ menu item and select the Installation menu item in the sub-navigation (WordPress Dashboard > Plugins > Install).

Use the Upload Plugin button to upload the plugin to your server.

image 51
WordPress Plugin Manager – Install Contact Form 7 Plugin

Then click on the “Activate” button to register the Contact Form 7 Double-Opt-in plugin with WordPress.

Configure double opt-in #

After installing the plugin, your Contact Form 7 forms, new settings are available (Forms > Contact Forms > [any_form] > Double-Opt-in).

To enable opt-in for one or more of your forms, first go to the form’s settings (Forms > Contact forms > [any_form]). There you will find a new tab called Double-Opt-in.

WordPress ContactForm7 Opt in Reiter
Contact Form 7 Double-Opt-in Forge12

There you can define all important settings for the double opt-in procedure.

cf7 optin einstellungen
Contact Form 7 Double-Opt-in Settings
ParameterDescription
EnableBy setting the checkbox, the double opt-in for the form is activated.
CategoryThis option allows you to set a category for all opt-ins made through this form. All opt-ins will then be assigned to this category. The category can be created via the opt-in settings.
Dynamic ConditionThis field helps you to activate the opt-in only when a checkbox is set or a field is filled in. The system will then automatically switch between an opt-in form and a standard form.
Confirmation PageThe checkbox allows you to set a custom confirmation page that will be displayed to the visitor after performing the opt-in.
ToIn this field, the placeholder for the Contact Form 7 tag of the opt-in recipient must be specified. E.G.: [email], [your-email].
FromThis field allows you to specify a custom sender. If you do not enter a sender here, the WordPress default settings will be used.

Example:
Max Mustermann <[_site_admin_email]> or
[_site_title] <[_site_admin_email]> or
Max Mustermann <[email protected]>
SubjectThe subject of the opt-in email.
TemplateAn email template for the opt-in mails can be selected with a click. Alternatively, an individual HTML can be created in the message body.
Message BodyThe content of the double opt-in mail. HTML can also be used here.

For the double opt-in to work, the shortcode [doubleoptinlink] must be integrated as a link, e.g.:
&st;a href=”[doubleoptinlink]”&gt;Bestätigen&st;/a&gt;

Shortcode:
[doubleoptinlink]
This automatically generates the confirmation link for the double opt-in.
Settings for the Contact Form 7 double opt-in system.

Furthermore, in addition to the standard Contact Form 7 tags, additional shortcodes are available for use in the message body:

WordPress ShortcodeDescription
[doubleoptinlink]Creates the link responsible for executing the opt-in.
[doubleoptin_form_url]Contains the path to the form filled in by the visitor to start the opt-in process.
[doubleoptin_form_subject]The subject of the double opt-in form.
[doubleoptin_form_date]The date when the opt-in was performed.
[doubleoptin_form_time]The time when the opt-in was performed.
[__site_admin_email]The WordPress email address
Contact Form 7 TagsAll Contact Form 7 fields are also available for the opt-in email.
Shortcodes and tags for the message body of the double opt-in

How the double opt-in system works #

Activating the double opt-in system also changes the behavior of the form.

User confirms double opt-in #

These steps are executed in case the user confirms the double opt-in:

  1. Double opt-in mail is sent
  2. Visitor confirms the double opt-in link
  3. Double opt-in information is stored
  4. Normal e-mail (1) is sent
  5. Normal e-mail (2) will be sent – if this has been activated.

User does not confirm double opt-in #

These steps are performed in case the user does not confirm the double opt-in:

  1. Double opt-in mail is sent
  2. Visitor does not confirm the link within 7 days
  3. Data will be deleted

Old data will be deleted automatically by a WP cron job after the time you selected. You have several options to choose from here.

image 1
Automatic deletion of opt-in, messages using WP Cronjob.

What data is stored #

A double opt-in must be logged. This ensures that the e-mail can really be assigned to the recipient.

For this purpose, our plugin stores some information. The information can be viewed at any time via Tools / Forge12 Double-Opt-in.

ParameterDescription
Form IDThe link and ID for which the user has given consent.
E-MailThe email used by the visitor when filling out the form.
Registration DateThe date and time the form was filled out.
Registration IPThe IP address with which the visitor filled in and sent the form.
Confirmation DateThe date and time the visitor clicked on the confirmation link.
Confirmation IPThe IP address with which the visitor confirmed the double opt-in.
ConfirmedYes/No – Indicates whether the double opt-in was confirmed by the recipient.
Opt-Out DateThe date when the visitor unsubscribed from the opt-in through the opt-out system.
Opt-Out IPThe IP address with which the visitor performed the opt-out.
Form FieldsThe field label and the content of the fields of the form.
FormularThe form as HTML element used for the opt-in.
Opt-In MailThe content of the opt-in mail as HTML.
Log data of the double opt-in

All data is stored for the duration you set in order to be able to prove that a visitor has registered via the double opt-in and that this has been confirmed. Even after an opt-out, the data will be kept for 30 days.

Export Double-Opt-in Data #

All performed opt-ins can be exported as a CSV file at any time. Both individual and all opt-ins can be exported. If categories are used, only opt-in information of a certain category can be exported as well.

Export all opt-in data #

To export all data, go to Forge12 Double Opt-In > Dashboard in the WordPress backend. There you will find an overview of the most recent opt-ins. At the end of the table, you will find the button to export all entries as CSV.

image 2
Export all opt-ins as CSV

Export individual opt-in data #

It is also possible to export only single information. To do this, go to Forge12 Double Opt-In > Dashboard in the WordPress backend. Then move the mouse over the desired opt-in to get the link to the details page. On the details page, you will find the button to export the data (Export as CSV).

image 3
Export individual opt-in data to WordPress.

Export all opt-in data of a category #

To export all opt-ins of a category, go to Forge12 Double Opt-In > Categories > [category name] in the WordPress backend. There you will find all opt-ins that have been assigned to the respective category. The option to export the opt-ins can be found at the end of the table (Export as CSV).

image 4
Export opt-in information of a category.

How to use the opt-out system #

With version 2 of the opt-in system, the possibility of giving visitors the option to unsubscribe from performed opt-ins was integrated.

The opt-out page for the visitor #

First, you need a new page, on which everything else will be displayed for the visitor later. To do this, simply create a new page in the backend of WordPress and insert the following shortcode.

[f12-cf7-doubleoptin-optout-list]

Of course, you can continue to design the page and add additional content. The only important thing is that the shortcode is placed on the page.

Configure the opt-out #

Next, go to Forge12 Double Opt-In > Opt-out in the backend of WordPress. There, you can now make all further settings for the opt-out.

image 5
Opt-out Settings
EinstellungDescription
Opt-Out PageThe page on which the [f12-cf7-doubleoptin-optout-list] shortcode is located must be specified here. The visitor will be redirected to this page once he performs the opt-out.
SubjectThe subject of the opt-out mail.
BodyThe message body of the opt-out mail. Here, the placeholder [doubleoptin_optout_url] must be explicitly integrated as a link.
Settings for the Contact From 7 opt-out system.

The opt-out form #

The last thing to do is to integrate the opt-out form. For this, you use the following shortcode.

[f12-cf7-doubleoptin-optout-form]

The shortcode creates a simple form through which the visitor can access the opt-out process.

image 6
Example Opt-Out Form

Once the form has been submitted, a one-time link is generated and sent to the selected e-mail address. The link is only temporarily valid and will be deleted afterwards.

The shortcode for the form can be placed anywhere on the page. The display can then be done via the WordPress Customizer or by separate CSS files.

The Opt-Out List #

As soon as the visitor clicks on the opt-out link, he will be redirected to the previously created page, where he will receive an overview of all performed and pending opt-ins. This can look like the following, for example:

image 7
Overview of all performed and pending opt-ins

The visitor then sees whether and when the opt-in was performed and how long the data is stored. Via Opt-Out now! He can also unsubscribe from performed opt-ins. The column “valid until” results from the configured settings.

Available filters and hooks for the extension #

For developers, we offer the possibility to access built-in WordPress hooks to connect the system to external interfaces.

Double opt-ins #

Allows to process opt-ins that have been performed twice. (e.g. when the opt-in link is clicked twice).

/**
 * @param string
 * @param OptIn $OptIn
 */
function already_confirmed($hash, $OptIn){
   // Do Something
}
add_action('f12_cf7_doubleoptin_already_confirmed', 'already_confirmed', 10, 2);

Before the opt-in confirmation #

Allows to edit an opt-in before it is saved.

/**
 * @param string
 * @param OptIn $OptIn
 */
function before_confirm($hash, $OptIn){
   // Do Something
}
add_action('f12_cf7_doubleoptin_before_confirm', 'before_confirm', 10, 2);

After the opt-in confirmation #

Allows modifying the opt-in after confirmation. Also allows passing the opt-in to interfaces after confirmation.

/**
 * @param string
 * @param OptIn $OptIn
 */
function after_confirm($hash, $OptIn){
   // Do Something
}
add_action('f12_cf7_doubleoptin_after_confirm', 'after_confirm', 10, 2);

After sending the opt-in mail #

Allows to perform further steps after sending the opt-in mail.

/**
 * @param array $form_data - An Array containing all dynamic form fields and placeholder data.
 * @param int $post_id - The Form ID
 */
function after_optin_mail_sent($form_data, $post_id){
   // Do Something
}
add_action('f12_cf7_doubleoptin_sent', 'after_optin_mail_sent', 10, 2);

Summary #

Using the Forge12 Double-Opt-in Plugin for Contact Form 7 is quick and easy thanks to its integration. Thanks to the logging of the data, proof of the double opt-in can be provided at any time.

Do you have ideas how to extend the plugin, or would you like to have additional features? Then just write us a comment.

Hier klicken, um den Beitrag zu bewerten
[Gesamt: 2 Durchschnitt: 5]

Leave A Comment

Title