Skip to main content

benecaster_token_reactivation_recoverable_reasons

Filter Premium

Controls which kinds of revoked access a later subscription activation is allowed to restore.

By default, every automated pathway is restorable — a cancelled membership, an expired grace period, an expired promotional window, a manual grant that reached its end date. A deliberate revoke by the podcaster is deliberately not, because a membership plugin firing an activation event must never undo a decision the podcaster made by hand.

The Migration Wizard adds migration_grace_expired, so somebody whose migration grace period ran out and who pays later gets their original feed link back rather than being charged with no private episodes.

This exists so an add-on can add its own automated revoke pathway. Revoke with your own reason, add that reason here, and a subscriber who lapses that way resubscribes normally. Leave a reason out and it behaves like a deliberate revoke: reactivation is refused and benecaster_token_reactivation_blocked fires instead.

TokenManager::revoke_unless_subscribed() requires its reason to be on this list. It throws InvalidArgumentException for a reason that is missing or not recoverable, because the point of that call is that a later payment brings the feed back. Add your reason here before you call it; see Revoke a listener’s feed only if they are not a member.

Do not add the deliberate-revoke reason to this list. It would silently disable the guard that stops a membership plugin restoring access a podcaster removed by hand, and the failure is invisible — everything appears to work.

Non-string entries and duplicates are stripped after the filter runs, so a callback returning a malformed array degrades rather than breaking activation.

Parameters

Name Type Default Description
$reasons string[] — The recoverable sentinel list. Append to it; do not replace it wholesale unless you mean to.

Returns: string[]

Examples

Let an add-on's own automated revoke pathway reactivate

add_filter( 'benecaster_token_reactivation_recoverable_reasons', function ( array $reasons ): array {
    // Tokens this add-on revoked automatically should come back
    // when the subscriber resubscribes, the same as a lapsed bridge.
    $reasons[] = 'my_addon_compliance_hold';
    return $reasons;
} );

Notes

A revoked row carrying no reason at all is treated as recoverable regardless of this filter, so a subscriber can never be stranded by a missing reason.

The default list is BRIDGE_CANCELLATION, GRACE_TIMEOUT, PROMOTE_GRACE_EXPIRED and MANUAL_GRANT_EXPIRED; ADMIN_REVOKED is the one deliberately excluded.

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