PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.6.3
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.6.3
5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 All 38 releases
← All changes | src/Integration/OptInError.php +41 -0 5.6.0 → 5.6.3 View file →
@@ -138,8 +138,49 @@
138 138 return $this->context;
139 139 }
140 140
141 141 /**
142 + * Must the visitor see this error, whatever the site configured?
143 + *
144 + * Only for errors the visitor caused and can fix on the spot. A refused
145 + * consent is one: the form looked sent, no mail ever came, and the only
146 + * hint was a toast over a green "Thank you" that vanished after ten
147 + * seconds (CF7, Core 5.6.1). Rate limits, blocklists and the like stay
148 + * behind `f12_cf7_doubleoptin_show_validation_error` — telling a bot why
149 + * it was refused is not always wanted.
150 + *
151 + * @return bool
152 + */
153 + public function isAlwaysShown(): bool {
154 + return self::CONSENT_NOT_GIVEN === $this->code;
155 + }
156 +
157 + /**
158 + * Should the form show this error in place of its own success message?
159 + *
160 + * @param int $formId The form the submission came from.
161 + *
162 + * @return bool
163 + */
164 + public function shouldShowToVisitor( int $formId ): bool {
165 + if ( $this->isAlwaysShown() ) {
166 + return true;
167 + }
168 +
169 + /**
170 + * Whether a refused submission's reason is shown in the form.
171 + *
172 + * Default false. A refused consent is always shown and never
173 + * reaches this filter.
174 + *
175 + * @param bool $show Show the error.
176 + * @param OptInError $error The error (since 5.6.2).
177 + * @param int $formId The form (since 5.6.2).
178 + */
179 + return (bool) apply_filters( 'f12_cf7_doubleoptin_show_validation_error', false, $this, $formId );
180 + }
181 +
182 + /**
142 183 * Get the default translatable messages for all error codes.
143 184 *
144 185 * @return array<string, string>
145 186 */