{"id":132245,"date":"2020-12-01T11:21:33","date_gmt":"2020-12-01T11:21:33","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/otp-by-email-for-contact-form-7\/"},"modified":"2023-05-02T11:02:21","modified_gmt":"2023-05-02T11:02:21","slug":"otp-by-email","status":"publish","type":"plugin","link":"https:\/\/ceb.wordpress.org\/plugins\/otp-by-email\/","author":13190743,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.2.0","stable_tag":"1.2.0","tested":"6.2.9","requires":"4.4","requires_php":"5.6","requires_plugins":null,"header_name":"OTP by Email for Contact Form 7","header_author":"aurovrata","header_description":"Enable OTP validation of an email field using the CF7 notification email.","assets_banners_color":"","last_updated":"2023-05-02 11:02:21","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/donate?hosted_button_id=V6CMZPJSW7KXS","header_plugin_uri":"https:\/\/github.com\/aurovrata\/otp-by-email","header_author_uri":"https:\/\/profiles.wordpress.org\/aurovrata\/","rating":0,"author_block_rating":0,"active_installs":80,"downloads":2050,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0":{"tag":"1.0","author":"aurovrata","date":"2020-12-10 07:46:21"},"1.1":{"tag":"1.1","author":"aurovrata","date":"2020-12-14 15:58:52"},"1.2.0":{"tag":"1.2.0","author":"aurovrata","date":"2023-05-02 11:02:21"}},"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.1","1.2.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[16871,2182,18971,9210,193625],"plugin_category":[],"plugin_contributors":[85842],"plugin_business_model":[],"class_list":["post-132245","plugin","type-plugin","status-publish","hentry","plugin_tags-contact-form-7-extension","plugin_tags-email-validation","plugin_tags-email-verification","plugin_tags-otp","plugin_tags-otp-by-email","plugin_contributors-aurovrata","plugin_committers-aurovrata"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/otp-by-email.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Use this CF7 extension to enable OTP links to be inserted into confirmation\/notification emails sent to email addresses submitted through your CF7 forms.  The OTP is a unique link the email inbox user needs to click to confirm their address.  The link is valid by default for 72 hours and can be customised.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Install Contact Form 7 plugin<\/li>\n<li>Install OTP by Email plugin extension<\/li>\n<li>OTP tag requires an email field in your CF7 forms.<\/li>\n<li>In CF7 forms with email fields, a mail tag <code>[otp-&lt;field-name&gt;]<\/code> will be available to insert into your notification\/confirmation email which will all a unique time-limited URL for users to confirm their email.<\/li>\n<li>In the form editor page, the OTP tab allows you to set the pages to redirect to when an email is validated or fails due to an outdated link.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='0.%20what%20does%20this%20plugin%20do%20%3F'><h3>0. What does this plugin do ?<\/h3><\/dt>\n<dd><p>If you are collecting an email address in your CF7 form from a visitor, you can use this plugin to validate that email.<\/p>\n\n<p>The email field name will be used to create a unique OTP mail tag shortcode to insert into your notification mail (sent to that email).  The shortcode will be replaced by a unique URL which the recipient can click on to validate their email.  This unique link is created using WordPress nonce API, and it stored in the DB as a transient with a default validity of 72 hours (3 days).  You can customise this validity period, please refer to the FAQ below for more details.  When a recipient clicks on a valid link, they are redirected to the <em>On Success<\/em> page you configured in the OTP tab.  If the link is no longer valid, they are taken to the <em>On failure<\/em> page instead, where you may give them the option to send them a new OTP link.<\/p>\n\n<p>You can use this plugin to go beyond simple email validation, as each valid user now has a unique way to identify themselves on your server.  I have used this plugin to create a conference registration and submission form for speakers without having them to actually create a user account on the server.  A visitor registers as a speaker, and once their email is validated, they use their OTP link (which expires a week prior to the conference start date) in order to submit talks for the conference without having to have an account.<\/p>\n\n<p>If you need to explore such functionality, you can contact me on \"vrata at syllogic dot in\".<\/p><\/dd>\n<dt id='1.%20is%20it%20possible%20to%20change%20the%20time-limit%20for%20the%20link%20validity%20%3F'><h3>1. Is it possible to change the time-limit for the link validity ?<\/h3><\/dt>\n<dd><p>The unique confirmation link has a 3-day (72 hours) validity by default, you can change it with the following filter,<\/p>\n\n<pre><code>add_filter('otp_by_email_lifetime', 'otp_by_email_validity',10,3);\nfunction otp_by_email_validity($limit, $email, $form_id){\n  \/\/you can set different time limits for different email domains or form ID.\n  $limit = 24 * HOUR_IN_SECONDS;  \/\/limit is in seconds.\n  return $limit;\n}\n<\/code><\/pre><\/dd>\n<dt id='2.%20how%20to%20retrieve%20an%20email%20that%20has%20been%20validated%20%3F'><h3>2. How to retrieve an email that has been validated ?<\/h3><\/dt>\n<dd><p>Use the following filter,<\/p>\n\n<pre><code>add_filter('otp_by_email_validated', 'otp_validated',10,3);\nfunction otp_validated($url, $email, $form_id){\n  \/\/you can identify a validated email and the form ID from which it was submitted.\n  \/\/you can also change the URL to which you want to redirect.\n  return $url;\n}\n<\/code><\/pre><\/dd>\n<dt id='3.%20how%20to%20retrieve%20an%20email%20that%20failed%20due%20to%20an%20outdated%20link%20%3F'><h3>3. How to retrieve an email that failed due to an outdated link ?<\/h3><\/dt>\n<dd><p>Use the following filter,<\/p>\n\n<pre><code>add_filter('otp_by_email_failed', 'otp_failed',10,3);\nfunction otp_failed($url, $email, $form_id){\n  \/\/you can identify a failed email and the form ID from which it was submitted.\n  \/\/you can also change the URL to which you want to redirect.\n  return $url;\n}\n<\/code><\/pre><\/dd>\n<dt id='4.%20is%20it%20possible%20to%20get%20an%20otp%20link%20for%20an%20email%20programmatically%20%3F'><h3>4. Is it possible to get an OTP link for an email programmatically ?<\/h3><\/dt>\n<dd><p>Yes, you can use the following function to retrieve a unique link,<\/p>\n\n<pre><code>\/**\n* Funiton to get a link for email validation.\n* @param String $email a valid email.\n* @param String $form_id the id of the form on which this email was submitted. (Defaults to 0).\n* @return String a unique link to validate the email, reurns false if the $email is invalid.\n* @since 1.0\n*\/\n$link = get_otp_by_email_link($email, $form_id=0);\n<\/code><\/pre><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.2.0<\/h4>\n\n<ul>\n<li>clarify the OTP tab settings and mail tag functionality.<\/li>\n<\/ul>\n\n<h4>1.1.2<\/h4>\n\n<ul>\n<li>fix form ID field bug.<\/li>\n<\/ul>\n\n<h4>1.1.1<\/h4>\n\n<ul>\n<li>changed location of action hook otp_by_email_unique_link_created and added nonce field as attribute.<\/li>\n<\/ul>\n\n<h4>1.1.0<\/h4>\n\n<ul>\n<li>added action hook otp_by_email_unique_link_created<\/li>\n<li>added nonce field in otp_by_email_validated filter hook attributes.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>fix display of tab in admin page.<\/li>\n<\/ul>","raw_excerpt":"A small Contact Form 7 extension plugin to enable email confirmation by unique links sent to the email inbox.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/132245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=132245"}],"author":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/aurovrata"}],"wp:attachment":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=132245"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=132245"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=132245"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=132245"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=132245"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=132245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}