Skip to main content

React when a show switches episode notifications on

Premium Intermediate Email Editor

Each show’s Episode Notifications tab saves four settings. The two actions fire around a save with ( int $show_id, array $settings ), where $settings is what is stored: enabled (bool, off by default), trigger (per_tier, the default, or teaser), authoring (template, the default, or compose) and autoplay (bool, off by default: whether the player card’s link carries ?bc_autoplay=1).

Code

<?php
add_action( 'benecaster_email_editor_after_notification_settings_save', function ( int $show_id, array $settings ): void {
    if ( $settings['enabled'] ) {
        my_crm_note( $show_id, 'Episode emails are on, sent ' . ( 'teaser' === $settings['trigger'] ? 'at publish' : 'as each tier unlocks' ) );
    }
}, 10, 2 );

View on GitHub →

Hooks Used

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