benecaster_subscription_tier_changed
Fires when a subscriber moves from one tier to another in either direction — upgrades and downgrades. The subscriber’s token record is updated to reflect the new tier before this hook fires, so feed content changes immediately on the subscriber’s next poll.
A built-in-membership subscriber who changes plan from their account page moves at one of two moments:
- An upgrade is charged the day they ask and lands as soon as the payment succeeds — straight away, or after their bank’s 3D Secure check. This fires then, and it is the only action an upgrade fires: none of the
*_scheduledorcadence_switch*actions. An upgrade that also changes billing period fires this for the plan, then benecaster_subscription_cadence_switch_scheduled for the period, which still lands at the renewal. - A move down, or to a tier at the same price, lands at their next renewal, so this fires then. The request itself fires benecaster_subscription_tier_switch_scheduled.
It also fires for an admin tier change and a plan changed directly in the Stripe dashboard.
It does not fire for a plan change made in MemberPress, Paid Memberships Pro, Restrict Content Pro or WooCommerce Subscriptions. Those plugins report the new tier as an activation on a subscriber who is already active, and that path deliberately sends no Tier Change email — which this hook’s path does. To hear every tier move whatever reported it, listen to benecaster_subscription_tier_moved, which also fires straight after this one wherever this one fires. Never listen to both for the same job.
A move onto the show’s free plan fires it when the move lands, followed by benecaster_subscription_free_switch_landed. The opposite direction does not: a free member who takes out a paid plan goes through signup, which fires benecaster_subscription_activated with $source 'resubscribe' instead.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID |
$show_id |
int |
— | ID of the show |
$old_tier_slug |
string |
— | Previous tier slug |
$new_tier_slug |
string |
— | New tier slug |
Examples
Update CRM on tier upgrade or downgrade
add_action( 'benecaster_subscription_tier_changed', function (
int $user_id,
int $show_id,
string $old_tier_slug,
string $new_tier_slug
) {
$email = get_userdata( $user_id )->user_email;
my_crm_update_contact_field( $email, 'podcast_tier', $new_tier_slug );
my_crm_add_note( $email, sprintf(
'Tier changed from %s to %s for show %d',
$old_tier_slug,
$new_tier_slug,
$show_id
) );
}, 10, 4 );
Need this built rather than just documented? See our services →