Skip to main content

benecaster_tenure_badge_output

Filter Free

Filters the finished HTML of a tenure badge chip just before it is displayed, letting you replace it with whatever markup you prefer — wrapping it in a tooltip, linking it to a page explaining how tenure is earned, or adding an anniversary graphic.

Only automatic tenure badges pass through this filter. Badges tied to a tier, and badges granted by hand, are displayed unchanged.

$show_id is 0 when the chip is displayed on the site-wide account page, and carries the actual show ID on per-show surfaces such as the Supporter Wall.

Parameters

Name Type Default Description
$html string — Assembled chip HTML produced by the built-in renderer.
$user_id int — WordPress user ID of the subscriber.
$show_id int — Show ID for per-show renders. 0 on the site-wide account page render.

Returns: string

Examples

Wrap the tenure chip in a tooltip explaining how tenure is calculated

add_filter( 'benecaster_tenure_badge_output', function ( string $html, int $user_id, int $show_id ): string {
    return '<span class="my-tooltip" data-tip="' . esc_attr( __( 'Based on your subscription start date', 'my-addon' ) ) . '">'
        . $html
        . '</span>';
}, 10, 3 );

Affects

  • Subscriber Account Page
  • Supporter Wall

Need this built rather than just documented? See our services →