Skip to main content

benecaster_token_reset

Action Premium Since v1.0.0

Fires after a subscriber’s token is reset and a new one is active. The old token has been invalidated, the new token is live, and the subscriber’s feed URL has already changed. The $old_token_prefix parameter is provided for audit logging — the full old token is never available after a reset.

Because the feed URL changes immediately on reset, any podcast app still using the old URL will fail to update on its next poll and the subscriber will need to add the new feed URL to their app. Benecaster sends a built-in “your feed URL has changed” email when a token is reset; to send a fully custom notification instead, suppress the built-in email using benecaster_email_should_send and dispatch your own from within this hook. Premium only: not registered when no valid license is active.

Parameters

Name Type Default Description
$token_id int ID of the token record (unchanged — the token value changes, not the record ID)
$user_id int WordPress user ID
$show_id int ID of the show
$old_token_prefix string First 8 characters of the old token for logging purposes

Examples

Write reset event to audit log

add_action( 'benecaster_token_reset', function (
    int    $token_id,
    int    $user_id,
    int    $show_id,
    string $old_token_prefix
) {
    global $wpdb;

    $wpdb->insert(
        $wpdb->prefix . 'my_security_audit_log',
        [
            'event'            => 'token_reset',
            'user_id'          => $user_id,
            'show_id'          => $show_id,
            'new_token_id'     => $token_id,
            'old_token_prefix' => $old_token_prefix,
            'ip_address'       => sanitize_text_field( $_SERVER['REMOTE_ADDR'] ?? '' ),
            'logged_at'        => current_time( 'mysql' ),
        ],
        [ '%s', '%d', '%d', '%d', '%s', '%s', '%s' ]
    );
}, 10, 4 );

Notes

Premium only: not registered when no valid license is active. $old_token_prefix (first 8 characters of the old token) is safe to log — it cannot be used to reconstruct the full token or pass validation.