Skip to main content

benecaster_token_revoked

Action Premium

Fires when a subscriber’s token is explicitly revoked. Fires on all revocations — admin manual, automated, and system-triggered. After this hook fires, the token is immediately inactive and the subscriber’s feed will return empty on its next poll.

Token revocation is distinct from subscription cancellation. Revoking a token removes the subscriber’s feed access without touching their membership plugin subscription — the subscription continues to exist in your membership plugin; Benecaster simply stops serving the feed for that token. Use this hook to audit or log access revocations that occur outside the normal subscription lifecycle. For revocations initiated specifically by an admin through the subscriber detail panel, see benecaster_subscriber_access_revoked.

Parameters

Name Type Default Description
$token_id int ID of the revoked token record
$user_id int WordPress user ID
$show_id int ID of the show

Examples

Insert revocation to audit log

add_action( 'benecaster_token_revoked', function (
    int $token_id,
    int $user_id,
    int $show_id
) {
    global $wpdb;

    $wpdb->insert(
        $wpdb->prefix . 'my_security_audit_log',
        [
            'event'      => 'token_revoked',
            'token_id'   => $token_id,
            'user_id'    => $user_id,
            'show_id'    => $show_id,
            'revoked_at' => current_time( 'mysql' ),
            'revoked_by' => get_current_user_id(),
        ],
        [ '%s', '%d', '%d', '%d', '%s', '%d' ]
    );
}, 10, 3 );

Notes

Use benecaster_subscription_cancelled to respond to the normal subscription cancellation lifecycle — token revocation is not the standard cancellation path.

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