Skip to main content

benecaster_sponsor_manager_after_save_message

Action Premium sponsor-manager

Fires once a sponsor message has been created or changed on the Sponsors screen’s Messages tab, or through POST /benecaster-sponsor-manager/v1/shows/{show_id}/messages or PUT, PATCH /benecaster-sponsor-manager/v1/shows/{show_id}/messages/{id}. It fires only when the write succeeded. Sponsor Manager then clears the show’s feed cache, so every episode carrying the message’s tag picks up the new copy.

Parameters

Name Type Default Description
$message_id int — The message saved
$show_id int — The message's show
$fields array — What was written, cleaned: `title`, `body` (HTML through `wp_kses_post`), `start_date`, `end_date` (`YYYY-MM-DD` or `''`) and `sponsor_id` (`0` for none). On a create, all five; on an update, only the keys sent
$created bool — `true` for a new message, `false` for a change

Example

// Log every change to a show's sponsor copy for the ad-sales team.
add_action( 'benecaster_sponsor_manager_after_save_message', function ( int $message_id, int $show_id, array $fields, bool $created ): void {
    if ( array_key_exists( 'body', $fields ) ) {
        my_sales_log( $show_id, $message_id, $created ? 'created' : 'copy changed' );
    }
}, 10, 4 );

Notes

Affects

  • Benecaster → Sponsors → Messages
  • POST benecaster-sponsor-manager/v1/shows/{show_id}/messages
  • PUT, PATCH benecaster-sponsor-manager/v1/shows/{show_id}/messages/{id}

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