benecaster_tier_unmapped
Fires when a membership tier is detected by the bridge but has no corresponding row in the tier map. The hook fires from two call sites: in real time from the subscription listener when a tier-save event arrives from an active bridge, and from the daily bridge sync cron as a 24-hour fallback for bridges whose tier-saved callback is a no-op. Both paths confirm the tier is absent from the map before firing.
The built-in admin notice system reacts to this action automatically — adding a callback here supplements that behavior and does not replace the built-in notice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$tier_id |
int|string |
— | The tier ID as reported by the bridge |
$plugin_slug |
string |
— | Slug of the bridge plugin that reported the tier |
Examples
Send Slack alert on unmapped tier detection
add_action( 'benecaster_tier_unmapped', function ( $tier_id, string $plugin_slug ): void {
// Debounce — alert at most once per tier per day.
$key = 'benecaster_tier_unmapped_alerted_' . $plugin_slug . '_' . $tier_id;
if ( get_transient( $key ) ) {
return;
}
set_transient( $key, true, DAY_IN_SECONDS );
$message = sprintf(
'New %s tier (ID: %s) detected with no Benecaster mapping. Visit Settings to map it.',
$plugin_slug,
$tier_id
);
wp_remote_post( MY_SLACK_WEBHOOK_URL, [
'body' => wp_json_encode( [ 'text' => $message ] ),
'headers' => [ 'Content-Type' => 'application/json' ],
] );
}, 10, 2 );
Notes
This action fires on every event where the tier is absent — both real-time saves and daily sync runs. If the same unmapped tier triggers multiple saves (for example, an admin repeatedly saving a membership level), this action fires each time. Guard with a transient or user meta flag to alert only once per tier per day.