Skip to main content

TierGateShortcode

\Benecaster\Shortcodes\TierGateShortcode

Class Premium

Implements [benecaster_tier_gate] and registers the [benecaster_else] marker. Registered via ShortcodeManager. Not licence-gated — every install can use it, since an unlicensed install has no paid tiers to begin with, so every visitor already takes the else branch.

Constructor Dependencies

Type Description
TierGateEvaluator

Methods

Method Visibility Since Description
register(): void Public Registers both benecaster_tier_gate and benecaster_else with add_shortcode().
render( array|string $atts, ?string $content = null ): string Public Splits the raw content on the first else marker via TierGateEvaluator::split_branches(), decides the branch with TierGateEvaluator::meets_minimum(), and runs do_shortcode() on the taken branch only — the other branch's shortcodes never execute.
render_stray_else(): string Public Callback for a [benecaster_else] found outside any gate — returns ''.

Constants

Name Value Description
TAG 'benecaster_tier_gate' The enclosing shortcode tag.
ELSE_TAG 'benecaster_else' The branch-separator marker tag.

Hooks Fired

Notes

Constructor changed from ( MembershipTierRepository, TierMapRepository ) to ( TierGateEvaluator $evaluator ) in feature/tier-gate-feed-resolution, when ranking and branch-splitting moved into TierGateEvaluator so the RSS feed's FeedTierGate could share the same logic rather than reimplementing it. Tier resolution: benecaster_get_user_tier_for_show().