Skip to main content

benecaster_member_thanks_query_types

Filter Free Since v1.0.0

Filters the registered query type instances available to the `[benecaster_member_thanks]` shortcode and — when the Podcast Workflow add-on is active — to the Member Thanks tile in the Episode Workbench. The array is keyed by type slug; each value must implement `BenecasterMemberThanksQueryInterface`.

The interface requires three methods: `get_label(): string` (display name for the selector dropdown), `get_description(): string` (helper text below the selector), and `get_results(int $show_id, int $episode_id, array $args): array` (the query itself). Each result record must include at minimum `user_id`, `display_name`, `tier_slug`, and `joined_at`. Always honor `tier_slug` and `count` from `$args` when they are set. Built-in type slugs are: `new_since_last_episode`, `random_cycling`, and `milestone`.

Parameters

Name Type Default Description
$types array Keyed array of query type instances; key is the type slug, value implements BenecasterMemberThanksQueryInterface

Returns: array

Examples

Register top supporters query type

add_filter( 'benecaster_member_thanks_query_types', function( $types ) {
    // Register a custom query type that returns top supporters by lifetime value.
    $types['top_supporters'] = new My_Plugin_Top_Supporters_Query();
    return $types;
} );

Full interface class implementation

class My_Top_Supporters_Query implements BenecasterMemberThanksQueryInterface {

    public function get_label(): string {
        return 'Top Supporters';
    }

    public function get_description(): string {
        return 'Members with the highest cumulative lifetime donations.';
    }

    public function get_results( int $show_id, int $episode_id, array $args ): array {
        $limit = $args['count'] ?? 5;
        $tier  = $args['tier_slug'] ?? null;
        return my_get_top_supporters( $show_id, $limit, $tier );
    }
}

add_filter( 'benecaster_member_thanks_query_types', function( array $types ): array {
    $types['top_supporters'] = new My_Top_Supporters_Query();
    return $types;
} );

Notes

Custom types added via this filter appear automatically in the Episode Workbench tile's query selector dropdown — no Workbench code changes are needed. Do not use any of the built-in type slugs (new_since_last_episode, random_cycling, milestone) as your own key.

Affects

  • [benecaster_member_thanks] shortcode
  • Member Thanks tile in Episode Workbench (Podcast Workflow add-on)