PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.8.1
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.8.1
5.8.0 5.8.1 5.7.0 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 All 41 releases
← All changes | src/Service/PrivacyIntegration.php +27 -3 5.1.6 → 5.8.1 View file →
@@ -10,8 +10,9 @@
10 10
11 11 namespace Forge12\DoubleOptIn\Service;
12 12
13 13 use Forge12\DoubleOptIn\Entity\OptIn;
14 +use Forge12\DoubleOptIn\Repository\OptInMailStatusRepository;
14 15 use Forge12\DoubleOptIn\Repository\OptInRepositoryInterface;
15 16 use Forge12\Shared\LoggerInterface;
16 17
17 18 if ( ! defined( 'ABSPATH' ) ) {
@@ -27,11 +28,20 @@
27 28
28 29 private LoggerInterface $logger;
29 30 private OptInRepositoryInterface $repository;
30 31
31 - public function __construct( LoggerInterface $logger, OptInRepositoryInterface $repository ) {
32 + /**
33 + * Delivery status of the confirmation mail (5.8.0). Optional so existing
34 + * callers keep working.
35 + *
36 + * @var OptInMailStatusRepository|null
37 + */
38 + private $mailStatus;
39 +
40 + public function __construct( LoggerInterface $logger, OptInRepositoryInterface $repository, ?OptInMailStatusRepository $mailStatus = null ) {
32 41 $this->logger = $logger;
33 42 $this->repository = $repository;
43 + $this->mailStatus = $mailStatus;
34 44 }
35 45
36 46 /**
37 47 * Register privacy hooks.
@@ -147,8 +157,18 @@
147 157 'value' => (string) $optIn->getFormId(),
148 158 ),
149 159 );
150 160
161 + if ( $this->mailStatus !== null ) {
162 + $mail = $this->mailStatus->find( $optIn->getId() );
163 + if ( $mail['status'] !== '' ) {
164 + $data[] = array(
165 + 'name' => __( 'Confirmation mail', 'double-opt-in' ),
166 + 'value' => trim( $mail['status'] . ' ' . $mail['at'] . ( $mail['error'] !== '' ? ' — ' . $mail['error'] : '' ) ),
167 + );
168 + }
169 + }
170 +
151 171 $items[] = array(
152 172 'group_id' => 'double-opt-in',
153 173 'group_label' => __( 'Double Opt-In Records', 'double-opt-in' ),
154 174 'item_id' => 'doi-' . $optIn->getId(),
@@ -159,9 +179,9 @@
159 179 $this->logger->info(
160 180 'Personal data exported',
161 181 array(
162 182 'plugin' => 'double-opt-in',
163 - 'email' => $email,
183 + // No address in the log (rules/gdpr.md).
164 184 'count' => count( $items ),
165 185 )
166 186 );
167 187
@@ -192,8 +212,12 @@
192 212 $anonymized = $this->anonymizeOptIn( $optIn );
193 213
194 214 try {
195 215 $this->repository->save( $anonymized );
216 + // The mail error text can quote the address.
217 + if ( $this->mailStatus !== null ) {
218 + $this->mailStatus->clearError( $optIn->getId() );
219 + }
196 220 ++$retained;
197 221 } catch ( \RuntimeException $e ) {
198 222 $this->logger->error(
199 223 'Failed to anonymize OptIn',
@@ -217,9 +241,9 @@
217 241 $this->logger->info(
218 242 'Personal data anonymized',
219 243 array(
220 244 'plugin' => 'double-opt-in',
221 - 'email' => $email,
245 + // No address in the log (rules/gdpr.md).
222 246 'retained' => $retained,
223 247 )
224 248 );
225 249