Skip to main content

React to a free follower signup

Free Intermediate Since v1.0.0

[benecaster_follower_signup] creates a WordPress user and inserts a token_type = 'follower' row, then fires benecaster_follower_signed_up( int $user_id, int $show_id, string $tier_slug ) before the welcome email is dispatched. Does not fire for returning followers (idempotent signup). benecaster_follower_tier_slug filters the tier slug to differentiate per-show follower tiers. For custom signup UIs, call FollowerSignup::signup() directly — the service is idempotent and handles double-clicks safely.

Code

<?php
// Tag a follower in your ESP without enabling the Email Integrations add-on.
add_action( 'benecaster_follower_signed_up', function ( int $user_id, int $show_id, string $tier_slug ): void {
    $user = get_userdata( $user_id );
    if ( ! $user instanceof \WP_User ) {
        return;
    }
    my_esp_tag_subscriber( $user->user_email, 'benecaster_follower' );
}, 10, 3 );

// Use a show-specific follower tier slug so per-show availability rules can target it.
add_filter( 'benecaster_follower_tier_slug', function ( string $tier_slug, int $show_id ): string {
    $show = get_post( $show_id );
    return $show ? $show->post_name . '-follower' : $tier_slug;
}, 10, 2 );

View on GitHub →

Hooks Used