GracePeriodExpiryCheck
Benecaster\Cron\GracePeriodExpiryCheck
Daily cron class that manages the two-pass grace period lifecycle for Promote to Bridge subscribers.
Schedule
Registered on the daily WP-Cron event. Runs once every 24 hours.
Two Passes per Tick
Each cron run executes two independent passes:
Expiry Pass
Queries benecaster_subscriptions for rows where promote_grace_period_ends_at is in the past and the subscription status is not yet expired_grace.
For each matching row:
- Revokes the subscriber’s feed token
- Sets subscription status to
expired_grace - Queues a
promote_grace_expiredemail - Fires
benecaster_promote_grace_expiredaction
Reminder Pass
Queries for rows where promote_grace_period_ends_at is between 6 and 8 days from now and status is still active.
For each matching row:
- Checks for a transient
benecaster_grace_reminder_sent_{subscription_id}— if present, skips (reminder already sent this window) - Queues a
promote_grace_reminderemail - Sets the transient with a 9-day TTL to prevent re-sending
The 6–8 day window and the transient TTL ensure that the reminder fires exactly once regardless of how many daily cron ticks fall within the window.
Related Classes
SubscriptionRepositorygrace-period methods — the read/write layer used by both passesPromotionService— sets the initialpromote_grace_period_ends_atvalue when the wizard runs