Skip to main content

benecaster_subscriber_no_active_membership

Action Free Since v1.0.0

Fires when a valid, active feed token is presented but the subscriber has no active membership tiers mapped in Benecaster. The token itself is valid and active in the database — the subscriber simply has no active mapped membership at request time. This covers subscriptions that have lapsed, been cancelled, or whose membership level has been removed from the tier map. A 403 response is returned to the subscriber after this hook fires.

Distinct from [benecaster_token_invalid](/hooks/benecaster_token_invalid/), which fires when a token fails validation (bad format, not found, or wrong show). This hook fires only when the token is fine but the subscription status behind it is not. The token itself is not revoked by this event.

Parameters

Name Type Default Description
$user_id int WordPress user ID
$show_id int ID of the show

Examples

Log event and trigger re-engagement campaign

add_action( 'benecaster_subscriber_no_active_membership', function (
    int $user_id,
    int $show_id
): void {
    $user = get_userdata( $user_id );
    if ( ! $user ) {
        return;
    }

    // Rate-limit: only act once per user per 7 days.
    $flag_key = '_benecaster_no_membership_flagged_' . $show_id;
    $last_flagged = get_user_meta( $user_id, $flag_key, true );

    if ( $last_flagged && ( time() - (int) $last_flagged ) < WEEK_IN_SECONDS ) {
        return;
    }

    update_user_meta( $user_id, $flag_key, time() );

    my_crm_tag_lapsed_subscriber( $user->user_email, $show_id );
}, 10, 2 );

Notes

This hook fires on every feed request where the condition is true — potentially once per podcast app poll interval. Guard with rate-limiting or caching if your callback makes external API calls. This hook is Free and registers regardless of license status.