Skip to main content

benecaster_license_grace_recovered

Action Free Since v1.0.0

Fires from GraceExpiryTracker::on_license_validated() when a /validate response returning status: valid closes a previously-open payment-failed grace window. Completes the grace-lifecycle trio alongside benecaster_license_grace_started and benecaster_license_grace_expired.

When this action fires, OverLimitFlagManager::on_license_validated() has already run (it is bound first) and cleared the is_over_limit = 1 flags on all tokens. Full private-feed access is restored on the next feed poll. The benecaster_license_grace_started_at option has also been deleted.

Use this action to dismiss any grace-related admin notice, send a customer-facing “you’re back — subscribers can access private feeds again” email, or emit telemetry on grace duration.

Parameters

Name Type Default Description
$started_at int Unix timestamp when the grace window was originally opened
$duration_seconds int Elapsed grace time in seconds (now − started_at), clamped to zero on server clock drift. Divide by DAY_IN_SECONDS to get days elapsed.

Examples

Send a recovery notification when the license returns to valid

add_action( 'benecaster_license_grace_recovered', function ( int $started_at, int $duration_seconds ): void {
    $days = intdiv( $duration_seconds, DAY_IN_SECONDS );
    wp_remote_post( MY_ALERT_ENDPOINT, [
        'body' => wp_json_encode( [
            'event'            => 'license_grace_recovered',
            'grace_days'       => $days,
            'recovered_at'     => time(),
            'site'             => home_url(),
        ] ),
    ] );
}, 10, 2 );

Notes

This action fires at most once per grace window (the moment recovery is detected). By the time it fires, subscriber tokens are already unflagged and private feeds are live again — no additional action is needed to restore access.