SupporterWallQuery
\Benecaster\SupporterWall\SupporterWallQuery
Runs the database query that returns the rows of a show’s Supporter Wall. A subscriber is listed when they hold an active token on the show and have switched on the wall-visibility preference on their account page. The [benecaster_supporter_wall] shortcode and the GET /shows/{id}/supporter-wall REST endpoint both call it, so the two always list the same people in the same order.
Followers are listed alongside paying subscribers. The query never filters on token type; each row carries a token_type of subscriber or follower so the caller can label it.
It returns stored values only. Each row’s message is the subscriber’s “Why I support” text exactly as saved, whether or not the show displays messages, so the caller must apply the show’s message toggle before rendering. Nor does the query decide the name to show: pass each row to benecaster_resolve_wall_display_name() for that.
Most add-ons never call this class. To render a wall, use the [benecaster_supporter_wall] shortcode; to consume one from JavaScript or another system, use the public REST endpoint. Call the query directly only when you need the roster rows in PHP without the shortcode’s markup.
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
find( int $show_id, int $limit, ?string $tier_slug, string $order ): array |
Public | — | Returns an array of row objects, or an empty array when $show_id is zero or negative or nothing matches. $limit is clamped to between 1 and MAX_LIMIT. $tier_slug restricts the result to one tier when it is a non-empty string; null or an empty string means all tiers. $order is 'alphabetical' (by wp_users.display_name, then login), 'tier' (highest tier first, ranked by the tier's position in the show's tier list, oldest join first within a tier, unranked tiers last) or anything else for the default, oldest join first. One row is returned per user even when the user holds several tokens on the show. Each row has user_id (the user ID as returned by the database), user_login, display_name (the WordPress display name, the fallback in the name-resolution chain), wall_display_name (the name the subscriber chose for the wall, empty when unset), first_name, last_name, tier_slug, token_type (subscriber or follower), joined_at (the token's creation time, a UTC MySQL datetime string) and message (the stored "Why I support" text, empty when unset). Numeric columns arrive as strings, so cast user_id before comparing it strictly. |
Constants
| Name | Value | Description |
|---|---|---|
MAX_LIMIT |
500 |
Upper bound on the number of rows a single call returns. A larger $limit is silently clamped to it, and a $limit below 1 becomes 1. |
Notes
find() reads $wpdb directly and applies no capability check, so a caller exposing its output must decide what the audience may see. Rows include user_login, which the public wall never shows. The wall-visibility opt-in is what makes a subscriber listable at all; do not add a join or condition that bypasses it.