benecaster_tenure_badge_label
Filters the label on a subscriber’s tenure badge once Benecaster has worked out which milestone they have reached. Use it to rename a milestone, translate it, or replace the wording entirely — whatever you return is what the subscriber sees.
An empty $label means the subscriber has not reached the first milestone yet, and by default no badge is shown for them at all. Returning a non-empty string is therefore how you give newer subscribers a badge of their own — “New Supporter”, say — rather than nothing until they reach the first milestone.
Which show the tenure is measured against. On per-show surfaces such as the Supporter Wall, $show_id is the show being displayed. On the site-wide account page there is no single show, so tenure is measured from the subscriber’s longest-standing active subscription and $show_id is that show. It is 0 only when the subscriber has no active subscriptions at all.
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
- Subscriber Account Page
- Supporter Wall
Need this built rather than just documented? See our services →