benecaster_admin_tier_change_notify
Fires when an admin enables ‘Send notification’ during a single or bulk tier change operation. This action fires after [benecaster_subscription_tier_changed](/hooks/benecaster_subscription_tier_changed/), which always fires on every tier change regardless of notification setting.
Hook here to dispatch a custom tier change email or trigger an external notification before the built-in email system is available. The built-in email system hooks this action at priority 10 to send the standard tier change email. You can supplement it or replace it entirely by removing the default callback.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$token_id |
int |
— | ID of the token record |
$user_id |
int |
— | WordPress user ID |
$show_id |
int |
— | ID of the show |
$old_tier |
string |
— | Previous tier slug |
$new_tier |
string |
— | New tier slug |
Examples
Send tier change via webhook
add_action( 'benecaster_admin_tier_change_notify', function (
int $token_id,
int $user_id,
int $show_id,
string $old_tier,
string $new_tier
): void {
$user = get_userdata( $user_id );
if ( ! $user ) {
return;
}
wp_remote_post( MY_WEBHOOK_URL, [
'body' => wp_json_encode( [
'email' => $user->user_email,
'old_tier' => $old_tier,
'new_tier' => $new_tier,
'show_id' => $show_id,
] ),
'headers' => [ 'Content-Type' => 'application/json' ],
] );
}, 10, 5 );
Notes
Free. Registered regardless of license status.
Do not confuse this with benecaster_subscription_tier_changed — that hook fires on every tier change from any source (bridge events, admin changes, imports). This hook fires only on admin-initiated changes where the admin has checked 'Send notification.'