Skip to main content

BridgeWritable

Benecaster\Bridge\BridgeWritable

Interface that a subscription bridge must implement to appear as a destination option in the Promote to Bridge wizard. Bridges that only implement BridgeInterface (read-only) are not shown as promotion targets.

Methods

can_import()

public function can_import(): bool

Returns true when the bridge is able to create new member records programmatically. Returning false excludes the bridge from the Promote to Bridge target list even if BridgeWritable is implemented.

A bridge might return false when the required API credentials are not configured, or when the target plugin is installed but not fully activated.


supports_tier()

public function supports_tier( int $tier_id ): bool

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 the wizard run executes.


create_member()

public function create_member(
    string $email,
    int    $user_id,
    int    $tier_id,
    array  $meta = []
): bool

Creates a member account for the given subscriber in the target membership plugin. Returns true on success, false when the member already exists, and throws on unexpected errors.

Parameter Description
$email Subscriber’s email address
$user_id WordPress user ID
$tier_id Target plugin membership level ID
$meta Optional context data passed through from PromotionService (e.g. show_id, tier_slug)

Core Bridge Implementations

Five built-in bridges implement BridgeWritable:

Bridge Class
MemberPress MemberPressBridge
WooCommerce Subscriptions WooSubscriptionsBridge
Paid Memberships Pro PaidMembershipsBridge
Restrict Content Pro RestrictContentBridge

Custom Bridge Note

If you have built a custom bridge implementing BridgeInterface, it will not appear in the Promote to Bridge wizard unless you also implement BridgeWritable. See Integrate a Membership Plugin Not in the Core Bridge Set for the custom bridge recipe — extend that recipe with the three BridgeWritable methods to make your bridge promotable.