| @@ -24,8 +24,14 @@ | ||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function handleWpUserProfileUpdated($userId, $oldData, $newData = []) |
| 27 | 27 | { |
| 28 | + // State is recorded only while the store requires verification; accounts | |
| 29 | + // without it are treated as existing accounts if verification is enabled later. | |
| 30 | + if (!EmailVerificationService::isEnabled()) { | |
| 31 | + return; | |
| 32 | + } | |
| 33 | + | |
| 28 | 34 | $user = $userId ? get_userdata($userId) : false; |
| 29 | 35 | $oldEmail = is_object($oldData) && isset($oldData->user_email) ? wp_unslash($oldData->user_email) : ''; |
| 30 | 36 | if (!$user || EmailVerificationService::isSame($oldEmail, $user->user_email)) { |
| 31 | 37 | return; |
| @@ -83,8 +89,12 @@ | ||
| 83 | 89 | } |
| 84 | 90 | |
| 85 | 91 | public function userRegistrationHandler($userId) |
| 86 | 92 | { |
| 93 | + if (!EmailVerificationService::isEnabled()) { | |
| 94 | + return; | |
| 95 | + } | |
| 96 | + | |
| 87 | 97 | $user = $userId ? get_userdata($userId) : false; |
| 88 | 98 | if ($user) { |
| 89 | 99 | EmailVerificationService::markPending((int) $userId, $user->user_email); |
| 90 | 100 | } |