Skip to main content

benecaster_token_quietly_revoked

Action Free

Fires when a token is revoked, or a revoked token’s reason changes, without benecaster_token_revoked, so an integration’s records do not go stale. $source says which: licence_cutoff (the day-30 license cutoff, $reason grace_timeout), lapse_sweep (the one-off sweep of old MemberPress and WooCommerce Subscriptions lapses, $reason bridge_cancellation) or reason_replaced (a real reason replaced another on a revoked row, such as someone cancelling after a cutoff, or a podcaster removing someone who already cancelled).

Parameters

Name Type Default Description
$token_id int — ID of the token record
$user_id int — WordPress user ID
$show_id int — ID of the show
$reason string — The value in the token's `revocation_reason`, a RevocationReasons value
$tier_slug string — The tier the token held
$source string — `licence_cutoff`, `lapse_sweep` or `reason_replaced`

Example

add_action( 'benecaster_token_quietly_revoked', function ( int $token_id, int $user_id, int $show_id, string $reason, string $tier_slug ): void {
    as_enqueue_async_action( 'my_addon_remove_tier_tag', [ $user_id, $show_id, $tier_slug ] );
}, 10, 5 );

Notes

Never send anyone email from it. It covers a lapse found months late and a podcaster's own unpaid license. That is why it is a separate action: benecaster_token_revoked drives the token.revoked webhook, the analytics churn count and badges, and no Benecaster code listens to this one.

At least once, and possibly late. A cutoff is announced by cron in batches of 200, 30 seconds apart, and a killed run repeats up to one batch, so read the token's current state before acting on an old announcement. Worked example: the recipe Keep an email list right through a license lapse.

Need this built rather than just documented? See our services →