GH#935: fix email verification gate — hold site publish until customer verifies email#937
Conversation
…935) When enable_email_verification=always, Stripe (or any payment gateway) can mark a membership active before the customer verifies their email. The transition_membership_status hook was unconditionally publishing the pending site, bypassing the email-verification gate. Changes: - Membership_Manager::transition_membership_status() — return early if the customer's email_verification is 'pending'; the site is published later by Customer_Manager once the email is verified. - Customer_Manager::maybe_verify_email_address() — add ACTIVE branch to the post-verification publish logic so sites held during a Stripe activation are published when the customer completes email verification. - Checkout_Pages::add_verify_email_notice() — remove the payment->get_total() === 0.0 guard so paid customers with 'always' verification also see the 'verify your email' notice on the thank-you page. - Tests — two focused regression tests for the email-gate behaviour in Membership_Manager_Test. Fixes #935
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 49 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What was doneFixed Root cause: Fixes applied:
How to verify: vendor/bin/phpunit --filter test_transition_status_skips_publish_when_customer_email_pending
vendor/bin/phpunit --filter test_transition_status_publishes_when_customer_email_not_pendingaidevops.sh v3.11.0 plugin for OpenCode v1.3.17 with claude-sonnet-4-6 spent 10m and 24,663 tokens on this as a headless worker. |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 2aaa648 are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
Summary
When
enable_email_verification=always, the payment gateway (e.g. Stripe) can activate a membership via webhook before the customer has verified their email. Thewu_transition_membership_statushook was unconditionally publishing the pending site on activation, completely bypassing the email-verification gate.Root cause
Membership_Manager::transition_membership_status()calledpublish_pending_site_async()without checking the customer'semail_verificationstatus.Changes
inc/managers/class-membership-manager.phpReturn early from
transition_membership_status()when the customer'semail_verification === 'pending'. The site is deferred until email verification completes.inc/managers/class-customer-manager.phpAdd an
ACTIVEbranch to the post-verification publish block inmaybe_verify_email_address(). Previously, the code only handledPENDINGandTRIALINGmemberships. With this fix, if the gateway already activated the membership before email was verified, the pending site is published once the customer clicks their verification link.inc/checkout/class-checkout-pages.phpRemove the
$payment->get_total() === 0.0guard fromadd_verify_email_notice(). Withalways, paid customers also need to see the "verify your email" banner on the thank-you page.tests/WP_Ultimo/Managers/Membership_Manager_Test.phpTwo regression tests covering the email-gate behaviour.
Verification
Resolves #935
aidevops.sh v3.11.0 plugin for OpenCode v1.3.17 with claude-sonnet-4-6 spent 10m and 23,862 tokens on this as a headless worker.