Skip to main content

[benecaster_user_badge]

Free

Renders a user’s badge chips (tier-auto grants + manual grants) inline. Defaults to the current logged-in user so the shortcode drops into member-only page templates without arguments.

Returns empty string when no user resolves or the user has no badges (no wrapper div is emitted). Enqueues assets/css/badges.css only when markup is actually emitted. Badge data passes through the benecaster_user_badges filter. Output filterable via benecaster_user_badge_shortcode_output.

Follower vs. subscriber classification: with show_id set, the wrapper is classified is-follower / is-subscriber (plus data-token-type) from the user’s token on that show, and a follower’s badge list picks up a “Follower” chip — so a follower with show_id always renders at least that chip. Without show_id, neither classification nor the Follower chip applies: one person can follow one show and pay for another, so a site-wide render can’t pick a side.

Tier-auto badges are earned on a subscriber token only. A follower’s free token never earns a tier’s badges, even when a membership tier shares the follower feed’s slug — the follower’s chip is the “Follower” label above. A follower who subscribes receives the new tier’s badges at once. Manual grants are unaffected either way.

Recipe

Style followers and subscribers differently

Premium Beginner

Free followers stay on the Supporter Wall alongside paying subscribers — Benecaster only labels them (a muted Follower chip) and classifies the markup so your theme decides how different they look. Three surfaces carry the classification, all in markup:

  • Supporter Wall card: .benecaster-supporter-wall__card.is-follower / .is-subscriber (also data-token-type).
  • Badge wrapper, when a show is in context (the wall, [benecaster_user_badge show_id="…"]): .benecaster-user-badges.is-follower / .is-subscriber.
  • The chips themselves: the Follower chip and the tenure chip carry .is-follower / .is-subscriber.
  • Account page: .benecaster-account__subscription.is-follower / .is-subscriber.
/* Paying subscribers get a highlighted card; followers stay quieter. */
.benecaster-supporter-wall__card.is-subscriber {
    border: 2px solid var(--wp--preset--color--primary, #4C1D95);
}
.benecaster-supporter-wall__card.is-follower {
    opacity: 0.85;
}

To drop the Follower chip entirely and rely on your own styling instead, remove its row on benecaster_user_badges — it is the only row with source === 'follower_auto':

Classify, don’t exclude. Do not filter followers out of the wall’s rows to “fix” the look — they opted in, and they are shown. Style them instead. The REST endpoint GET /shows/{id}/supporter-wall gives headless front ends the same signal as a token_type field on every item.

<?php
add_filter( 'benecaster_user_badges', function ( array $badges ): array {
    return array_values( array_filter(
        $badges,
        static fn( $b ) => 'follower_auto' !== ( $b->source ?? '' )
    ) );
}, 20 ); // after Benecaster appends it at priority 15

View on GitHub →

Parameters

Name Type Default Required Description
user_id int (current user) No WordPress user ID whose badges to render. Defaults to the currently logged-in user.
show_id int (site-wide) No Optional. Passed to benecaster_get_user_badges() so the benecaster_user_badges filter can scope badge visibility per show without changing the schema.

Example

<!-- Current user's badges on a member profile page -->
[benecaster_user_badge]

<!-- Specific user's badges -->
[benecaster_user_badge user_id="42"]

<!-- Badges scoped to a specific show for a forum integration -->
[benecaster_user_badge show_id="3"]