Skip to main content

benecaster_tenure_badge_output

Filter Free Since v1.0.0

Fires from BadgeChipRenderer::render_chip() after the built-in chip HTML is assembled, but only for badge rows where source === 'tenure_auto'. Tier and manually granted badges are not affected. Consumers can replace the chip HTML entirely — for example, wrapping the chip in a tooltip, adding a link to a “tenure explained” page, or appending an anniversary ribbon graphic.

$show_id is 0 when the chip is rendered on the site-wide account page (per-user mode); it carries the actual show ID when rendered 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

  • BadgeChipRenderer::render_chip()