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

Marc Wag­ner

June 14, 2021

9 min read|

With our plug­in Forge12 Dou­­b­le-Opt-in for Cont­act Form 7 you extend the Cont­act Form 7 Word­Press plug­in with an addi­tio­nal opt-in sys­tem (DOI).

For this, only a few simp­le steps are nee­ded to con­vert your form(s) to Word­Press forms.

You are curr­ent­ly vie­w­ing a pla­ce­hol­der con­tent from You­Tube. To access the actu­al con­tent, click the but­ton below. Plea­se note that doing so will share data with third-par­­ty pro­vi­ders.

More Infor­ma­ti­on

Install Double-Opt-in Plugin #

First, the plug­in must be instal­led via the Word­Press Plug­in Mana­ger. To do this, sim­ply go to the backend of your Word­Press web­site to the Plug­ins’ menu item and sel­ect the Instal­la­ti­on menu item in the sub-navi­­ga­­ti­on (Word­Press Dash­board > Plug­ins > Install).

Use the Upload Plug­in but­ton to upload the plug­in to your ser­ver.

image 51
Word­Press Plug­in Mana­ger — Install Cont­act Form 7 Plug­in

Then click on the “Acti­va­te” but­ton to regis­ter the Cont­act Form 7 Dou­­b­le-Opt-in plug­in with Word­Press.

Configure double opt-in #

After instal­ling the plug­in, your Cont­act Form 7 forms, new set­tings are available (Forms > Cont­act Forms > [any_form] > Dou­­b­le-Opt-in).

To enable opt-in for one or more of your forms, first go to the form’s set­tings (Forms > Cont­act forms > [any_form]). The­re you will find a new tab cal­led Dou­­b­le-Opt-in.

WordPress ContactForm7 Opt in Reiter
Cont­act Form 7 Dou­­b­le-Opt-in Forge12

The­re you can defi­ne all important set­tings for the dou­ble opt-in pro­ce­du­re.

cf7 optin einstellungen
Cont­act Form 7 Dou­­b­le-Opt-in Set­tings
Para­me­terDescrip­ti­on
EnableBy set­ting the check­box, the dou­ble opt-in for the form is acti­va­ted.
Cate­go­ryThis opti­on allows you to set a cate­go­ry for all opt-ins made through this form. All opt-ins will then be assi­gned to this cate­go­ry. The cate­go­ry can be crea­ted via the opt-in set­tings.
Dyna­mic Con­di­ti­onThis field helps you to acti­va­te the opt-in only when a check­box is set or a field is fil­led in. The sys­tem will then auto­ma­ti­cal­ly switch bet­ween an opt-in form and a stan­dard form.
Con­fir­ma­ti­on PageThe check­box allows you to set a cus­tom con­fir­ma­ti­on page that will be dis­play­ed to the visi­tor after per­forming the opt-in.
ToIn this field, the pla­ce­hol­der for the Cont­act Form 7 tag of the opt-in reci­pi­ent must be spe­ci­fied. E.G.: [email], [your-email].
FromThis field allows you to spe­ci­fy a cus­tom sen­der. If you do not enter a sen­der here, the Word­Press default set­tings will be used.

Exam­p­le:
Max Mus­ter­mann <[_site_admin_email]> or
[_site_title] <[_site_admin_email]> or
Max Mus­ter­mann <[email protected]>
Sub­jectThe sub­ject of the opt-in email.
Tem­p­la­teAn email tem­p­la­te for the opt-in mails can be sel­ec­ted with a click. Alter­na­tively, an indi­vi­du­al HTML can be crea­ted in the mes­sa­ge body.
Mes­sa­ge BodyThe con­tent of the dou­ble opt-in mail. HTML can also be used here.

For the dou­ble opt-in to work, the short­code [dou­ble­op­tin­link] must be inte­gra­ted as a link, e.g.:
&st;a href=”[doubleoptinlink]”&gt;Bestätigen&st;/a&gt;

Short­code:
[dou­ble­op­tin­link]
This auto­ma­ti­cal­ly gene­ra­tes the con­fir­ma­ti­on link for the dou­ble opt-in.
Set­tings for the Cont­act Form 7 dou­ble opt-in sys­tem.

Fur­ther­mo­re, in addi­ti­on to the stan­dard Cont­act Form 7 tags, addi­tio­nal short­codes are available for use in the mes­sa­ge body:

Word­Press Short­codeDescrip­ti­on
[dou­ble­op­tin­link]Crea­tes the link respon­si­ble for exe­cu­ting the opt-in.
[doubleoptin_form_url]Con­ta­ins the path to the form fil­led in by the visi­tor to start the opt-in pro­cess.
[doubleoptin_form_subject]The sub­ject of the dou­ble opt-in form.
[doubleoptin_form_date]The date when the opt-in was per­for­med.
[doubleoptin_form_time]The time when the opt-in was per­for­med.
[__site_admin_email]The Word­Press email address
Cont­act Form 7 TagsAll Cont­act Form 7 fields are also available for the opt-in email.
Short­codes and tags for the mes­sa­ge body of the dou­ble opt-in

How the double opt-in system works #

Acti­vat­ing the dou­ble opt-in sys­tem also chan­ges the beha­vi­or of the form.

User confirms double opt-in

The­se steps are exe­cu­ted in case the user con­firms the dou­ble opt-in:

  1. Dou­ble opt-in mail is sent
  2. Visi­tor con­firms the dou­ble opt-in link
  3. Dou­ble opt-in infor­ma­ti­on is stored
  4. Nor­mal e‑mail (1) is sent
  5. Nor­mal e‑mail (2) will be sent — if this has been acti­va­ted.

User does not confirm double opt-in

The­se steps are per­for­med in case the user does not con­firm the dou­ble opt-in:

  1. Dou­ble opt-in mail is sent
  2. Visi­tor does not con­firm the link within 7 days
  3. Data will be dele­ted

Old data will be dele­ted auto­ma­ti­cal­ly by a WP cron job after the time you sel­ec­ted. You have seve­ral opti­ons to choo­se from here.

image 1
Auto­ma­tic dele­ti­on of opt-in, mes­sa­ges using WP Cron­job.

What data is stored #

A dou­ble opt-in must be log­ged. This ensu­res that the e‑mail can real­ly be assi­gned to the reci­pi­ent.

For this pur­po­se, our plug­in stores some infor­ma­ti­on. The infor­ma­ti­on can be view­ed at any time via Tools / Forge12 Dou­­b­le-Opt-in.

Para­me­terDescrip­ti­on
Form IDThe link and ID for which the user has given con­sent.
E‑MailThe email used by the visi­tor when fil­ling out the form.
Regis­tra­ti­on DateThe date and time the form was fil­led out.
Regis­tra­ti­on IPThe IP address with which the visi­tor fil­led in and sent the form.
Con­fir­ma­ti­on DateThe date and time the visi­tor cli­cked on the con­fir­ma­ti­on link.
Con­fir­ma­ti­on IPThe IP address with which the visi­tor con­firm­ed the dou­ble opt-in.
Con­firm­edYes/No — Indi­ca­tes whe­ther the dou­ble opt-in was con­firm­ed by the reci­pi­ent.
Opt-Out DateThe date when the visi­tor unsub­scri­bed from the opt-in through the opt-out sys­tem.
Opt-Out IPThe IP address with which the visi­tor per­for­med the opt-out.
Form FieldsThe field label and the con­tent of the fields of the form.
For­mu­larThe form as HTML ele­ment used for the opt-in.
Opt-In MailThe con­tent of the opt-in mail as HTML.
Log data of the dou­ble opt-in

All data is stored for the dura­ti­on you set in order to be able to pro­ve that a visi­tor has regis­tered via the dou­ble opt-in and that this has been con­firm­ed. Even after an opt-out, the data will be kept for 30 days.

Export Double-Opt-in Data #

All per­for­med opt-ins can be expor­ted as a CSV file at any time. Both indi­vi­du­al and all opt-ins can be expor­ted. If cate­go­ries are used, only opt-in infor­ma­ti­on of a cer­tain cate­go­ry can be expor­ted as well.

Export all opt-in data

To export all data, go to Forge12 Dou­ble Opt-In > Dash­board in the Word­Press backend. The­re you will find an over­view of the most recent opt-ins. At the end of the table, you will find the but­ton to export all ent­ries as CSV.

image 2
Export all opt-ins as CSV

Export individual opt-in data

It is also pos­si­ble to export only sin­gle infor­ma­ti­on. To do this, go to Forge12 Dou­ble Opt-In > Dash­board in the Word­Press backend. Then move the mou­se over the desi­red opt-in to get the link to the details page. On the details page, you will find the but­ton to export the data (Export as CSV).

image 3
Export indi­vi­du­al opt-in data to Word­Press.

Export all opt-in data of a category

To export all opt-ins of a cate­go­ry, go to Forge12 Dou­ble Opt-In > Cate­go­ries > [cate­go­ry name] in the Word­Press backend. The­re you will find all opt-ins that have been assi­gned to the respec­ti­ve cate­go­ry. The opti­on to export the opt-ins can be found at the end of the table (Export as CSV).

image 4
Export opt-in infor­ma­ti­on of a cate­go­ry.

How to use the opt-out system #

With ver­si­on 2 of the opt-in sys­tem, the pos­si­bi­li­ty of giving visi­tors the opti­on to unsub­scri­be from per­for­med opt-ins was inte­gra­ted.

The opt-out page for the visitor

First, you need a new page, on which ever­y­thing else will be dis­play­ed for the visi­tor later. To do this, sim­ply crea­te a new page in the backend of Word­Press and insert the fol­lo­wing short­code.

[f12-cf7-doubleoptin-optout-list]

Of cour­se, you can con­ti­nue to design the page and add addi­tio­nal con­tent. The only important thing is that the short­code is pla­ced on the page.

Configure the opt-out

Next, go to Forge12 Dou­ble Opt-In > Opt-out in the backend of Word­Press. The­re, you can now make all fur­ther set­tings for the opt-out.

image 5
Opt-out Set­tings
Ein­stel­lungDescrip­ti­on
Opt-Out PageThe page on which the [f12-cf7-dou­­b­le­op­­tin-optout-list] short­code is loca­ted must be spe­ci­fied here. The visi­tor will be redi­rec­ted to this page once he per­forms the opt-out.
Sub­jectThe sub­ject of the opt-out mail.
BodyThe mes­sa­ge body of the opt-out mail. Here, the pla­ce­hol­der [doubleoptin_optout_url] must be expli­cit­ly inte­gra­ted as a link.
Set­tings for the Cont­act From 7 opt-out sys­tem.

The opt-out form

The last thing to do is to inte­gra­te the opt-out form. For this, you use the fol­lo­wing short­code.

[f12-cf7-doubleoptin-optout-form]

The short­code crea­tes a simp­le form through which the visi­tor can access the opt-out pro­cess.

image 6
Exam­p­le Opt-Out Form

Once the form has been sub­mit­ted, a one-time link is gene­ra­ted and sent to the sel­ec­ted e‑mail address. The link is only tem­po­r­a­ri­ly valid and will be dele­ted after­wards.

The short­code for the form can be pla­ced any­whe­re on the page. The dis­play can then be done via the Word­Press Cus­to­mi­zer or by sepa­ra­te CSS files.

The Opt-Out List

As soon as the visi­tor clicks on the opt-out link, he will be redi­rec­ted to the pre­vious­ly crea­ted page, whe­re he will recei­ve an over­view of all per­for­med and pen­ding opt-ins. This can look like the fol­lo­wing, for exam­p­le:

image 7
Over­view of all per­for­med and pen­ding opt-ins

The visi­tor then sees whe­ther and when the opt-in was per­for­med and how long the data is stored. Via Opt-Out now! He can also unsub­scri­be from per­for­med opt-ins. The column “valid until” results from the con­fi­gu­red set­tings.

Available filters and hooks for the extension #

For deve­lo­pers, we offer the pos­si­bi­li­ty to access built-in Word­Press hooks to con­nect the sys­tem to exter­nal inter­faces.

Double opt-ins

Allows to pro­cess opt-ins that have been per­for­med twice. (e.g. when the opt-in link is cli­cked 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 befo­re 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 modi­fy­ing the opt-in after con­fir­ma­ti­on. Also allows pas­sing the opt-in to inter­faces after con­fir­ma­ti­on.

/**
 * @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 per­form fur­ther steps after sen­ding 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 Dou­­b­le-Opt-in Plug­in for Cont­act Form 7 is quick and easy thanks to its inte­gra­ti­on. Thanks to the log­ging of the data, pro­of of the dou­ble opt-in can be pro­vi­ded at any time.

Do you have ide­as how to extend the plug­in, or would you like to have addi­tio­nal fea­tures? Then just wri­te us a com­ment.

88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar
  1. blank
    Micha­el Octo­ber 31, 2024 at 12:35 — Rep­ly

    Hi,
    the Down­load csv does­n’t work. The­re is no but­ton visi­ble.
    What can I do?
    Kind regards

  2. ac6edb55c1fefa891790daaeb15a79a3b9d22ed399292e234411aa67ac6fb9f6 54
    Marc Wag­ner Octo­ber 31, 2024 at 12:41 — Rep­ly

    Hi Micha­el,

    The CSV down­load fea­ture is only available in the Pro ver­si­on. If you alre­a­dy have the Pro ver­si­on and still don’t see the CSV down­load but­ton, plea­se feel free to open a sup­port ticket by wri­ting us a mail.

    Kind regards,
    Marc