Hook the resubscribe branch of benecaster_subscription_activated to react to a returning subscriber whose feed URL has just changed
When a previously-cancelled subscriber resubscribes, core deletes their prior token row and mints a fresh one (new hash, new feed URL). The activation hook fires with $source === 'resubscribe', and benecaster_token_generated fires for the new row. Listeners that store the token’s hash or full feed URL MUST treat 'resubscribe' as a new-token event. The legacy 'new' and 'migration' sources preserve the existing hash for subscribers who already had an active row.
Code
<?php
add_action( 'benecaster_subscription_activated', function ( int $user_id, int $show_id, string $tier_slug, string $source ): void {
if ( 'resubscribe' !== $source ) {
return;
}
// The token row has already been replaced — old feed URL is dead.
my_addon_invalidate_cached_feed_url( $user_id, $show_id );
my_addon_tag_user_in_crm( $user_id, 'returning-subscriber' );
}, 10, 4 );