diff --git a/includes/class-notifications.php b/includes/class-notifications.php index 16b7989..812cdf2 100644 --- a/includes/class-notifications.php +++ b/includes/class-notifications.php @@ -438,6 +438,18 @@ class DDHH_JM_Notifications { return; } + // Check if mentors have already been notified for this job + $already_notified = get_post_meta( $post->ID, '_ddhh_mentors_notified', true ); + if ( '1' === $already_notified ) { + error_log( + sprintf( + 'DDHH Job Manager: Skipping mentor notification for job #%d - mentors already notified on initial publish', + $post->ID + ) + ); + return; + } + // Get opted-in mentors $mentor_ids = DDHH_JM_User_Preferences::get_opted_in_mentors(); @@ -456,6 +468,9 @@ class DDHH_JM_Notifications { // Schedule async batch notifications $batch_count = DDHH_JM_Scheduler::schedule_mentor_notification_batch( $mentor_ids, $post->ID ); + // Mark job as having notified mentors to prevent duplicate notifications + update_post_meta( $post->ID, '_ddhh_mentors_notified', '1' ); + // Log success error_log( sprintf(