benecaster_tier_gate_passes
Whether the visitor gets the gated branch of [benecaster_tier_gate]. Fires before either branch renders, for conditions the min_tier/show_id attributes cannot express — a buy-up, a WordPress role, a date. Whichever branch the returned value selects is still the only one that runs.
Fires for every gate on the site, so a callback must scope itself by $show_id and $min_tier and return $passes untouched for gates it doesn’t mean to change.
Fires on every install, with no license check — website gating isn’t license-gated (operator decision).
Website only. Does not fire when the RSS feed resolves a gate — feeds are compiled and cached per tier, not per visitor, and a per-visitor answer written into a per-tier cache would hand one subscriber’s result to their whole tier. A condition OR’d in through this filter therefore opens the gate on the website only; the feed still resolves by tier alone.
Never pass a buy-up’s token_type as min_tier. A buy-up holder resolves to their base tier slug via benecaster_get_user_tier_for_show(), so a buy-up slug matches no tier and the gate stays shut for exactly the people who bought it, with no error. Use this filter plus benecaster_user_has_buyup() instead.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$passes |
bool |
— | Whether the visitor currently passes the gate, from the `min_tier` ranking check. |
$show_id |
int |
— | ID of the show the gate is on. |
$min_tier |
string |
— | The gate's `min_tier` attribute value. |
$user_tier |
string |
— | The visitor's resolved tier slug for this show (empty string when none). |
Returns:
bool
Example
add_filter(
'benecaster_tier_gate_passes',
function ( bool $passes, int $show_id, string $min_tier, string $user_tier ): bool {
// Already in on tier, or not a gate this snippet is about.
if ( $passes || 'growth' !== $min_tier ) {
return $passes;
}
// The buy-up's row ID in benecaster_buyups (here, "Transcripts").
$transcripts_buyup_id = 12;
// 0 = the current user. Passing $show_id scopes the grant to the
// show the gate is on, so a buy-up bought on another show can't open it.
return benecaster_user_has_buyup( 0, $transcripts_buyup_id, $show_id );
},
10,
4
);
Need this built rather than just documented? See our services →