PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.9.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.9.0
5.9.0 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 All 42 releases
← All changes | src/Service/PrivacyIntegration.php +33 -3 5.6.2 → 5.9.0 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,24 @@
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 + // Same wording as the opt-in detail page, not the stored key.
165 + $value = $mail['status'] === 'failed'
166 + /* translators: %s: date and time of the attempt */
167 + ? sprintf( __( 'Could not be sent (%s)', 'double-opt-in' ), $mail['at'] )
168 + /* translators: %s: date and time the mail was handed over */
169 + : sprintf( __( 'Handed to the mail server (%s)', 'double-opt-in' ), $mail['at'] );
170 + $data[] = array(
171 + 'name' => __( 'Confirmation mail', 'double-opt-in' ),
172 + 'value' => $value . ( $mail['error'] !== '' ? ' — ' . $mail['error'] : '' ),
173 + );
174 + }
175 + }
176 +
151 177 $items[] = array(
152 178 'group_id' => 'double-opt-in',
153 179 'group_label' => __( 'Double Opt-In Records', 'double-opt-in' ),
154 180 'item_id' => 'doi-' . $optIn->getId(),
@@ -159,9 +185,9 @@
159 185 $this->logger->info(
160 186 'Personal data exported',
161 187 array(
162 188 'plugin' => 'double-opt-in',
163 - 'email' => $email,
189 + // No address in the log (rules/gdpr.md).
164 190 'count' => count( $items ),
165 191 )
166 192 );
167 193
@@ -192,8 +218,12 @@
192 218 $anonymized = $this->anonymizeOptIn( $optIn );
193 219
194 220 try {
195 221 $this->repository->save( $anonymized );
222 + // The mail error text can quote the address.
223 + if ( $this->mailStatus !== null ) {
224 + $this->mailStatus->clearError( $optIn->getId() );
225 + }
196 226 ++$retained;
197 227 } catch ( \RuntimeException $e ) {
198 228 $this->logger->error(
199 229 'Failed to anonymize OptIn',
@@ -217,9 +247,9 @@
217 247 $this->logger->info(
218 248 'Personal data anonymized',
219 249 array(
220 250 'plugin' => 'double-opt-in',
221 - 'email' => $email,
251 + // No address in the log (rules/gdpr.md).
222 252 'retained' => $retained,
223 253 )
224 254 );
225 255