From 2c104022df3e3da71c2e99e1f0c9e52fd2bddd7e Mon Sep 17 00:00:00 2001 From: ruben Date: Fri, 7 Mar 2025 09:14:46 -0600 Subject: [PATCH] Updated to use correct scrubber pool --- ...lass-rl-mailwarmer-conversation-helper.php | 2 +- includes/class-rl-mailwarmer-scheduler.php | 2 +- includes/rl-mailwarmer-ajax.php | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/includes/class-rl-mailwarmer-conversation-helper.php b/includes/class-rl-mailwarmer-conversation-helper.php index a2569b5..63f8c88 100644 --- a/includes/class-rl-mailwarmer-conversation-helper.php +++ b/includes/class-rl-mailwarmer-conversation-helper.php @@ -353,7 +353,7 @@ class RL_MailWarmer_Conversation_Handler { // Fetch scrubber pool if 'received_by' is not passed if (!isset($args['received_by'])) { - $scrubber_pool_full = self::get_email_accounts_for_pool($campaign_id, 'scrubber_test'); + $scrubber_pool_full = self::get_email_accounts_for_pool($campaign_id, 'scrubber'); // Pick $num_particpants random addresses $num_scrubbers = min($num_particpants, count($scrubber_pool_full)); diff --git a/includes/class-rl-mailwarmer-scheduler.php b/includes/class-rl-mailwarmer-scheduler.php index 663513d..137f607 100644 --- a/includes/class-rl-mailwarmer-scheduler.php +++ b/includes/class-rl-mailwarmer-scheduler.php @@ -81,7 +81,7 @@ class RL_MailWarmer_Scheduler { */ public static function cron_process_pending_messages() { action_log("====================== Running Cron to process messages ========================"); - RL_MailWarmer_Message_Handler::process_pending_messages(); + // RL_MailWarmer_Message_Handler::process_pending_messages(); } /** diff --git a/includes/rl-mailwarmer-ajax.php b/includes/rl-mailwarmer-ajax.php index 752f2d8..b8ea75a 100644 --- a/includes/rl-mailwarmer-ajax.php +++ b/includes/rl-mailwarmer-ajax.php @@ -371,6 +371,8 @@ add_action('wp_ajax_rl_mailwarmer_save_campaign', function () { $post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0; $new_post = ($post_id == 0); $calculate_timeline = isset($_POST['calculate_timeline']) ? true : false; + $target_profession = false; + $target_profession_other = false; // Prepare post data $post_data = array( @@ -440,6 +442,15 @@ add_action('wp_ajax_rl_mailwarmer_save_campaign', function () { return; } break; + + case 'target_profession': + $target_profession = $_POST[$field]; + break; + + case 'target_profession_other': + $target_profession_other = $_POST[$field]; + break; + default: update_field($field, sanitize_text_field($_POST[$field]), $post_id); @@ -447,6 +458,20 @@ add_action('wp_ajax_rl_mailwarmer_save_campaign', function () { } } } + + if ($target_profession_other) { + $target_profession = $target_profession_other; + } + + // If no target profession is set, choose one from the default profession pool. + if ( ! $target_profession ) { + $professions = rl_get_textarea_meta_as_array('option', 'default_profession_pool'); + if ( ! empty($professions) ) { + // Assign a random profession from the list + $target_profession = $professions[array_rand($professions)]; + } + } + // Set campaign owner update_post_meta($post_id, 'owner_id', $current_user_id);