Skip to main content

benecaster_subscription_tier_switch_scheduled

Action Premium

Fires when a built-in-membership subscriber schedules a move to another tier from their account page — a move down, or to a tier at the same price. Nothing has been charged, and nothing about their access has moved: the change lands at their next renewal, $switch_at, which is when benecaster_subscription_tier_changed fires.

It does not fire for an upgrade. An upgrade is charged the day they ask and lands as soon as the payment succeeds, so there is nothing scheduled: it fires only benecaster_subscription_tier_changed, at that moment.

The subscriber is still on their old tier when this fires. Use $to_tier_slug; looking up their current tier returns the one they are leaving.

A scheduled move can be withdrawn before it lands, by the subscriber or because their membership is cancelled. That fires benecaster_subscription_cadence_switch_cancelled, so anything you record here should be treated as provisional. The same request also fires benecaster_subscription_cadence_switch_scheduled, straight after this one.

Parameters

Name Type Default Description
$user_id int — WordPress user ID
$show_id int — ID of the show
$from_tier_slug string — The tier they are on now, and will stay on until the switch lands
$to_tier_slug string — The tier they are moving to
$switch_at int — UTC epoch of the renewal the move lands on

Examples

Note the request in your CRM

add_action( 'benecaster_subscription_tier_switch_scheduled', function (
    int $user_id,
    int $show_id,
    string $from_tier_slug,
    string $to_tier_slug,
    int $switch_at
) {
    my_crm_add_note( get_userdata( $user_id )->user_email, sprintf(
        'Asked to move from %s to %s on %s',
        $from_tier_slug,
        $to_tier_slug,
        gmdate( 'Y-m-d', $switch_at )
    ) );
}, 10, 5 );

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