Skip to main content

benecaster_subscription_cancelled

Action Premium

Fires when any bridge reports that a subscription has been cancelled. This hook is bridge-agnostic — it fires regardless of which membership plugin triggered the cancellation. The subscriber’s token is marked inactive after this hook fires, and feed access ends on the subscriber’s next poll.

Note there is a brief window between when this hook fires and when the subscriber’s next feed request arrives. During that window, the subscriber may still have feed access even though their token is deactivated.

Parameters

Name Type Default Description
$user_id int Subscriber user ID.
$show_id int Show post ID.

Examples

Remove active tag and add churned tag in email platform

add_action( 'benecaster_subscription_cancelled', function (
    int $user_id,
    int $show_id
) {
    $email = get_userdata( $user_id )->user_email;

    my_email_platform_remove_tag( $email, 'active-subscriber' );
    my_email_platform_add_tag( $email, 'cancelled', [
        'show_id'      => $show_id,
        'cancelled_at' => current_time( 'mysql' ),
    ] );
}, 10, 2 );

Need this built rather than just documented? See our services →