BridgeWritable
\Benecaster\Bridge\BridgeWritable
Additional interface a bridge must implement to appear as a valid destination in the Promote to Bridge wizard. A bridge implementing only BridgeInterface can read subscription state but cannot create new member records programmatically. Implementing BridgeWritable signals that the bridge can create members in its target plugin. Four built-in bridges implement this interface: MemberPressBridge, WooSubscriptionsBridge, PaidMembershipsBridge, and RestrictContentBridge. The inert bridge a show gets when none is configured does not — there is nothing to import a membership into.
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
can_import(): bool |
Public | — | Returns true when the target plugin is installed, active, and exposes the API surface this bridge depends on. Returning false excludes the bridge from the Promote to Bridge target list even if BridgeWritable is implemented. |
supports_tier( int $tier_id ): bool |
Public | — | Returns true if the given tier ID exists in the target membership plugin and can receive new members. Used to validate the tier map before a wizard run executes. |
create_member( string $email, int $user_id, int $tier_id, array $meta = [] ): bool |
Public | — | Creates an active member record in the target plugin, no checkout, real charge, or order/invoice. Returns true on success, false on any failure (missing plugin function, invalid tier, plugin-side error) — every built-in implementation wraps its work in a try/catch and returns false rather than letting an exception propagate. Should be idempotent: calling it for a member who already holds the tier returns true without duplicating state. |