benecaster_tenure_badge_label
Fires after the milestone threshold map is matched in TenureBadgeCalculator::build_snapshot_from_row(), allowing consumers to rename, localise, or inject a label regardless of what the threshold map picked.
When $label is an empty string the subscriber’s tenure is below the lowest milestone threshold — the TenureBadgeAppender short-circuits and appends no chip for that subscriber. Return a non-empty string here to inject a label for below-first-milestone subscribers (e.g. “New Supporter”).
Per-show vs. site-wide render. On per-show surfaces (Supporter Wall) $show_id is the show being rendered. On the site-wide account page the calculator picks the earliest active token across all shows and passes that show’s ID as $show_id. $show_id === 0 only when the user has zero active tokens.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$label |
string |
— | Milestone label from the threshold map. Empty string when tenure is below the lowest threshold. |
$user_id |
int |
— | WordPress user ID of the subscriber. |
$show_id |
int |
— | Show ID contributing the tenure figure. 0 when the user has no active tokens. |
$months_since_join |
int |
— | Subscriber's tenure in whole months. |
Returns:
string
Examples
Override the label for very long-tenure subscribers regardless of milestone map
add_filter( 'benecaster_tenure_badge_label', function ( string $label, int $user_id, int $show_id, int $months_since_join ): string {
if ( $months_since_join >= 36 ) {
return __( 'Charter Member', 'my-addon' );
}
return $label;
}, 10, 4 );
Inject a "New Supporter" label for below-first-milestone subscribers
add_filter( 'benecaster_tenure_badge_label', function ( string $label, int $user_id, int $show_id, int $months_since_join ): string {
return $label !== '' ? $label : __( 'New Supporter', 'my-addon' );
}, 10, 4 );
Affects
- TenureBadgeCalculator::build_snapshot_from_row()