Skip to main content

benecaster_subscription_activated

Action Premium Since v1.0.0

Fires when a subscriber becomes active on any bridge, regardless of which membership plugin triggered the activation. This includes new sign-ups, resubscribes after a previous cancellation, subscribers imported via the Migration Wizard, and subscribers added via the Bulk Enrollment screen. The subscriber’s feed token is already generated at the point this hook fires.

The `$source` parameter distinguishes the origin of the activation: `’new’` for a first-time subscription, `’resubscribe’` for a returning subscriber, `’migration’` for an imported subscriber via the Migration Wizard, and `’admin_enrolled’` for subscribers added via Bulk Enrollment. When `$source === ‘resubscribe’`, the subscriber’s previous token row has been deleted and a fresh row inserted — any code that cached the old feed URL or token prefix must treat resubscribes as a new-token event.

Parameters

Name Type Default Description
$user_id int WordPress user ID
$show_id int ID of the show
$tier_slug string Tier slug
$source string One of 'new', 'resubscribe', or 'migration'

Examples

Tag subscriber in email platform by source

add_action( 'benecaster_subscription_activated', function (
    int    $user_id,
    int    $show_id,
    string $tier_slug,
    string $source
) {
    $email = get_userdata( $user_id )->user_email;

    if ( $source === 'new' ) {
        my_email_platform_subscribe( $email, [
            'tier'     => $tier_slug,
            'show_id'  => $show_id,
            'list_tag' => 'new-subscriber',
        ] );
    } elseif ( $source === 'resubscribe' ) {
        my_email_platform_reactivate( $email, [
            'tier'    => $tier_slug,
            'show_id' => $show_id,
        ] );
    }
}, 10, 4 );

Notes

This is a Premium hook — it fires only when a valid license is active. It fires from the subscription listener wired to all active bridges at init priority 20, so it fires regardless of which membership plugin is active on the site.