Skip to main content

FollowerBadgeAppender

\Benecaster\Membership\FollowerBadgeAppender

Class Free

Appends a “Follower” chip to a follower’s badge list when a show is in context, so a follower and a paying subscriber no longer look identical on the Supporter Wall and in [benecaster_user_badge show_id="…"]. Ships in feature/token-type-admin-surfaces. ⚠⚠ Classify, never exclude (operator ruling 2026-09-10). Followers stay on every surface they were on; this only gives them a label. The chip fills the slot a paying subscriber’s tier badge fills — tier badges already skip followers (see BadgeReconciler), so before this a follower’s only chip was the tenure badge, worded exactly like a subscriber’s. ⚠ Show context only. With no $show_id (the account page’s site-wide badge render) nothing is appended: one person can follow one show and pay for another, and a site-wide chip would have to pick one of those to be wrong about. ⚠ Label text is the whole default look, deliberately. No setting, no artwork (operator: the look is as much a theme concern as a plugin one). Themes restyle it through the chip’s is-follower class; a site that does not want it removes rows with source === 'follower_auto' on benecaster_user_badges. No dedicated filter — that one already does it. Registered on benecaster_user_badges at priority 15, ahead of TenureBadgeAppender (20), so a follower reads “Follower · 1-Year Member” the way a subscriber reads “Gold · 1-Year Member”. The admin Subscribers screen leaves this chip out (SubscribersController): it already labels follower rows “Follower (free)”.

Constructor Dependencies

Type Description
\Benecaster\Token\TokenRepository Resolves the user's active token type on the show to decide whether to append the chip.

Methods

Method Visibility Since Description
register(): void Public Hooks append_follower_badge() onto the benecaster_user_badges filter at priority 15.
append_follower_badge( array $badges, int $user_id, ?int $show_id ): array Public Filter callback. Appends the Follower chip row (via build_row()) when $user_id and $show_id are both positive and the user's active token on that show is 'follower' (per TokenRepository::find_active_token_type()). Returns $badges unchanged otherwise.
build_row( int $user_id, int $show_id ): \stdClass Builds the chip row in the shape BadgeChipRenderer renders — the same fields TenureBadgeAppender::build_row() emits (id, label, icon_slug, icon_attachment_id, color, source, granted_at, user_id, show_id), plus token_type = 'follower'.

Constants

Name Value Description
SOURCE follower_auto Badge source value identifying the computed Follower chip.
COLOR #9CA3AF Muted grey used for the chip — a label, not an award.
SYNTHETIC_ID -2 Synthetic id sentinel for the chip row. Persisted grants are positive auto-increment ids; the tenure chip's sentinel is -1 (TenureBadgeAppender::SYNTHETIC_ID).