Updated to use correct scrubber pool

This commit is contained in:
Ruben Ramirez 2025-03-07 09:14:46 -06:00
parent e251e7fe24
commit 2c104022df
3 changed files with 27 additions and 2 deletions

View file

@ -353,7 +353,7 @@ class RL_MailWarmer_Conversation_Handler {
// Fetch scrubber pool if 'received_by' is not passed // Fetch scrubber pool if 'received_by' is not passed
if (!isset($args['received_by'])) { 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 // Pick $num_particpants random addresses
$num_scrubbers = min($num_particpants, count($scrubber_pool_full)); $num_scrubbers = min($num_particpants, count($scrubber_pool_full));

View file

@ -81,7 +81,7 @@ class RL_MailWarmer_Scheduler {
*/ */
public static function cron_process_pending_messages() { public static function cron_process_pending_messages() {
action_log("====================== Running Cron to process messages ========================"); action_log("====================== Running Cron to process messages ========================");
RL_MailWarmer_Message_Handler::process_pending_messages(); // RL_MailWarmer_Message_Handler::process_pending_messages();
} }
/** /**

View file

@ -371,6 +371,8 @@ add_action('wp_ajax_rl_mailwarmer_save_campaign', function () {
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0; $post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
$new_post = ($post_id == 0); $new_post = ($post_id == 0);
$calculate_timeline = isset($_POST['calculate_timeline']) ? true : false; $calculate_timeline = isset($_POST['calculate_timeline']) ? true : false;
$target_profession = false;
$target_profession_other = false;
// Prepare post data // Prepare post data
$post_data = array( $post_data = array(
@ -440,6 +442,15 @@ add_action('wp_ajax_rl_mailwarmer_save_campaign', function () {
return; return;
} }
break; break;
case 'target_profession':
$target_profession = $_POST[$field];
break;
case 'target_profession_other':
$target_profession_other = $_POST[$field];
break;
default: default:
update_field($field, sanitize_text_field($_POST[$field]), $post_id); 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 // Set campaign owner
update_post_meta($post_id, 'owner_id', $current_user_id); update_post_meta($post_id, 'owner_id', $current_user_id);