Skip to main content

benecaster_license_grace_expired

Action Free Since v1.0.0

Fires from GraceExpiryTracker::maybe_flag_grace_expired() on every daily cron pass after the 30-day payment-failed grace window has elapsed without recovery. Unlike benecaster_license_grace_started, this action fires repeatedly — once per cron cycle — until the license recovers to valid.

On the first cron pass after the window elapses, GraceExpiryTracker also calls OverLimitFlagManager::flag_all_active_tokens(), which sets is_over_limit = 1 on every active subscriber token. From that point, FeedController routes all subscriber feed requests to the site’s public feed — subscribers keep hearing the show with no error, they just receive public episodes.

Use this action to route a repeated “still in grace expiry” signal to external alerting or to send a customer-facing “your subscribers have been dropped to the public feed” email.

Parameters

Name Type Default Description
$started_at int Unix timestamp when the grace window was originally opened — lets consumers compute how long the site has been past grace expiry (now() − started_at − 30×DAY_IN_SECONDS)

Examples

Send a daily alert while subscribers are on the public feed

add_action( 'benecaster_license_grace_expired', function ( int $started_at ): void {
    $days_past = intdiv( time() - $started_at - ( 30 * DAY_IN_SECONDS ), DAY_IN_SECONDS );
    wp_remote_post( MY_ALERT_ENDPOINT, [
        'body' => wp_json_encode( [
            'event'     => 'license_grace_expired',
            'days_past' => $days_past,
            'site'      => home_url(),
        ] ),
    ] );
} );

Notes

This action fires on every daily cron pass while the grace window is elapsed and the license has not recovered. Guard against duplicate side-effects (e.g. sending multiple emails) if you hook here — use the $started_at timestamp to detect the first firing vs. subsequent ones.