ManualMembershipUnsupportedTrait
\Benecaster\Bridge\ManualMembershipUnsupportedTrait
A trait that supplies a throwing create_manual_membership() for a bridge whose membership plugin cannot create an active member without a checkout and a real charge. Using it lets the bridge satisfy BridgeInterface without pretending to support the “Add subscriber manually” admin flow. The MemberPress, Paid Memberships Pro, Restrict Content Pro and WooCommerce Subscriptions bridges use it; the built-in native bridge implements the method itself.
A bridge that can create a comped member should not use the trait. Implement create_manual_membership() directly, and add a callback to the benecaster_bridge_supports_manual_membership filter that returns true for the bridge’s slug. That filter is what the manual-subscriber endpoint and the bridge REST response check, so the admin button appears only for bridges that opt in. The exception should therefore only ever be reached by a caller that skipped the check.
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
create_manual_membership( int $user_id, int $show_id, string $tier_slug, ?string $expiry_at ): array |
Public | — | Ignores its arguments and always throws \BadMethodCallException with the message 'Bridge does not support manual membership creation.'. It never returns. |
Notes
A real implementation must create the active member in the underlying plugin for the given tier, stamp the resulting token row as a manual grant, and record $expiry_at (a UTC MySQL datetime, or null for no expiry) so the manual-grant expiry cron can revoke it. Guard calls with benecaster_bridge_supports_manual_membership( $bridge_slug ) rather than catching the exception.