React when an admin connects a subscription bridge
Fires each time an admin saves a bridge selection — from both the setup wizard and the Settings → Subscription tab. Use to seed bridge-specific defaults, trigger an initial membership level sync, or log the connection event. Fires on re-saves too (changing bridges); guard with a flag in post meta if the work should only run once per show.
Code
<?php
add_action( 'benecaster_bridge_connected', function ( string $bridge_slug, int $show_id ): void {
$levels = Benecaster\Plugin::instance()->make( Benecaster\Bridge\BridgeManager::class )
->get_active_bridge( $show_id )
->get_all_tiers( $show_id );
foreach ( $levels as $level ) {
update_post_meta(
$show_id,
'_my_addon_level_' . sanitize_key( $level['id'] ) . '_synced',
current_time( 'mysql' )
);
}
}, 10, 2 );