benecaster_email_resubscribed
Fires when a subscriber opts back in to emails after having previously opted out. Use this hook to restore segments in external email marketing platforms, update CRM records, or log the re-opt-in event.
The $email_type parameter is the opt-out level being cleared: 'broadcast' re-enables non-transactional emails, 'episode_notifications' re-enables new-episode emails, and 'all' re-enables every Benecaster email. The $method parameter records how the resubscribe was triggered — useful for auditing and compliance reporting.
Benecaster itself never fires this today. It fires from UnsubscribeManager::resubscribe(), and no Benecaster screen or endpoint calls that: the unsubscribe link only opts out. It fires when another plugin or your own code calls resubscribe(), and each call writes a resubscribe row to the unsubscribe log.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int|null |
— | WordPress user ID, or null |
$show_id |
int |
— | ID of the show |
$email_type |
string |
— | The opt-out level cleared: 'broadcast', 'episode_notifications' or 'all' |
$email_address |
string |
— | Email address |
$method |
string |
— | How the change was made — 'api' by default |
Examples
Re-add subscriber to broadcast list
add_action( 'benecaster_email_resubscribed', function(
?int $user_id,
int $show_id,
string $email_type,
string $email_address,
string $method
): void {
if ( $email_type === 'broadcast' ) {
my_esp_client()->add_to_list( $email_address, 'podcast-broadcasts' );
}
}, 10, 5 );
Need this built rather than just documented? See our services →