Add only new signups to your mailing list, not imported or synced listeners
A podcaster moving from another platform imports hundreds of listeners at once, and Sync Existing Members links a whole membership. Neither is a new signup, and neither should land on a mailing list in one go. Both write tokens through the same action a signup does, so ask benecaster_is_import() and benecaster_is_member_sync() while it runs.
Code
<?php
add_action( 'benecaster_token_generated', function ( int $token_id, int $user_id, int $show_id ): void {
if ( benecaster_is_import() || benecaster_is_member_sync() ) {
return;
}
// Decide now, then queue: a job run later always hears false from both.
wp_schedule_single_event( time(), 'my_list_subscribe', [ $user_id, $show_id ] );
}, 10, 3 );
Hooks Used
Need this built rather than just documented? See our services →