Enabled creating a campaign from the edit email-account page

This commit is contained in:
Ruben Ramirez 2025-03-07 09:22:01 -06:00
parent 9ed17a4f29
commit 6815886683

View file

@ -21,16 +21,29 @@ if (isset($_GET['edit'])) {
} else {
$post_id = 0;
}
if (isset($_GET['Email_ID'])) {
$email_id = intval($_GET['Email_ID']);
$domain_id = get_field('domain', $email_id);
$email_accounts[] = $email_id;
$campaign_name = get_the_title($email_id);
} else {
$email_accounts = [];
$domain_id = '';
$campaign_name = '';
}
$campaign_data = [
'campaign_name' => '',
'domain_id' => '',
'email_accounts' => [],
'campaign_name' => $campaign_name,
'domain_id' => $domain_id,
'email_accounts' => $email_accounts,
'num_additional_emails' => '',
'start_date' => '',
'warmup_period' => '8',
'starting_volume' => '5',
'target_volume' => '50',
'weekend_reduction_factor' => 25,
'start_date' => date('Y-m-d', strtotime('today')),
'warmup_period' => 8,
'starting_volume' => 5,
'target_volume' => 200,
'weekend_reduction_factor' => 60,
'target_profession' => '',
'target_profession_other' => '',
'campaign_conversation_topics' => ''
@ -165,7 +178,7 @@ get_header(); ?>
<td>
<select id="email_accounts" name="email_accounts[]" multiple required class="email-accounts-select">
<?php
$selected_accounts = get_post_meta($post_id, 'email_accounts') ? get_post_meta($post_id, 'email_accounts', true) : [];
$selected_accounts = get_post_meta($post_id, 'email_accounts') ? get_post_meta($post_id, 'email_accounts', true) : $campaign_data['email_accounts'];
$user_email_accounts = get_posts([
'post_type' => 'email-account',
'posts_per_page' => -1,
@ -237,7 +250,7 @@ get_header(); ?>
<tr>
<th><label for="target_profession">Target Profession</label></th>
<td>
<select id="target_profession" name="target_profession" required>
<select id="target_profession" name="target_profession">
<option value="">Select Profession</option>
<?php foreach ($professions as $profession) :
?>