benecaster_get_member_thanks_rows()
benecaster_get_member_thanks_rows( int $show_id, array $user_ids ): array
Turns a list of user IDs into fully described Member Thanks rows. For add-ons registering a custom query type: your query decides who, this decides how they are described.
Filling those fields by hand means a five-way join — the tokens table for the tier, the users table plus three meta rows for the display-name resolution chain, and a grouped subquery over subscriber events for the join date. Reimplementing it is how a custom query type ends up emitting empty strings for tier_slug and joined_at, and rendering blank fields under a “thank you” heading.
It uses the same name-resolution chain and the same join as Benecaster’s own query types, so a custom type describes its members identically to a built-in one.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
show_id |
int |
— | Yes | Show post ID. |
user_ids |
int[] |
— | Yes | User IDs, in the order they should be rendered. |
Return Value
Type:
array
A list of {user_id, display_name, tier_slug, joined_at} rows — the shape a Member Thanks query type must return. In the order you passed the IDs, and possibly shorter than that list.
Example
public function get_results( int $show_id, int $episode_id, array $args ): array {
$user_ids = my_addon_top_donor_ids( $show_id, 30, (int) ( $args['count'] ?? 5 ) );
return benecaster_get_member_thanks_rows( $show_id, $user_ids );
}
Notes
Input order is preserved. If you ranked your members — top donors, most engaged — that ranking is the one thing Benecaster cannot recompute, so rows come back in the order you passed them rather than in database order.
IDs with no active token for this show are dropped, so the result can be shorter than your input. Do not index into it positionally against your own list. A former member is not a member, and a row rendering a blank tier is worse than no row at all.
Duplicate and non-positive IDs are ignored. An empty list returns an empty array without querying.
Need this built rather than just documented? See our services →