Skip to main content

Treat synced members as existing members in an integration

Premium Beginner

Sync existing members gives feed links to people who joined the membership plugin before the show was connected. It fires benecaster_subscription_synced, never benecaster_subscription_activated, so a CRM or email integration can add them without the new-member welcome sequence and carry their real start date across.

Code

<?php
add_action( 'benecaster_subscription_activated', function ( int $user_id, int $show_id, string $tier_slug ): void {
    my_crm_upsert_member( $user_id, $show_id, $tier_slug, [ 'start_welcome_sequence' => true ] );
}, 10, 3 );

add_action( 'benecaster_subscription_synced', function ( int $user_id, int $show_id, string $tier_slug, ?string $started_at ): void {
    my_crm_upsert_member( $user_id, $show_id, $tier_slug, [
        'start_welcome_sequence' => false,
        'member_since'           => $started_at, // UTC; null when the plugin had no usable date
    ] );
}, 10, 4 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →