+
+
+
@@ -115,14 +118,131 @@ get_header(); ?>
-
-
-
+ prefix . 'rl_mailwarmer_conversations';
+
+ // First, get all email accounts for this domain
+ $email_account_ids = array();
+ if (!empty($email_accounts)) {
+ foreach ($email_accounts as $account) {
+ $email_account_ids[] = $account->ID;
+ }
+ }
+
+ if (!empty($email_account_ids)) {
+ // Convert to a comma-separated string for SQL
+ $email_account_ids_str = implode(',', $email_account_ids);
+
+ // Find campaign IDs that use these email accounts
+ $campaign_ids = $wpdb->get_col("
+ SELECT DISTINCT campaign_id
+ FROM $conversations_table
+ WHERE email_account_id IN ($email_account_ids_str)
+ ");
+
+ if (!empty($campaign_ids)) {
+ // Get campaign details
+ $campaigns = get_posts([
+ 'post_type' => 'campaign',
+ 'posts_per_page' => -1,
+ 'post__in' => $campaign_ids
+ ]);
+
+ if (!empty($campaigns)) {
+ echo '
Campaigns (' . count($campaigns) . ')
';
+ echo '
';
+ echo '';
+ echo '| Campaign Name | ';
+ echo 'Tracking ID | ';
+ echo 'Start Date | ';
+ echo 'Target Volume | ';
+ echo 'Actions | ';
+ echo '
';
+ echo '';
+
+ foreach ($campaigns as $campaign) {
+ $tracking_id = get_post_meta($campaign->ID, 'campaign_tracking_id', true);
+ $start_date = get_post_meta($campaign->ID, 'start_date', true);
+ $target_volume = get_post_meta($campaign->ID, 'target_volume', true);
+
+ echo '';
+ echo '| ' . esc_html($campaign->post_title) . ' | ';
+ echo '' . esc_html($tracking_id) . ' | ';
+ echo '' . esc_html($start_date) . ' | ';
+ echo '' . esc_html($target_volume) . ' | ';
+ echo '';
+ echo 'View ';
+ echo 'Edit';
+ echo ' | ';
+ echo '
';
+ }
+
+ echo '
';
+ }
+ } else {
+ echo '
No campaigns found that use email accounts from this domain.
';
+ }
+ } else {
+ echo '
No campaigns found since there are no email accounts for this domain.
';
+ }
+
+ echo '
Create New Campaign
';
+ ?>
generate_construct_sidebars();
- get_footer();
+ get_footer();
\ No newline at end of file
diff --git a/single-email-account.php b/single-email-account.php
index 30579ed..2b95aae 100644
--- a/single-email-account.php
+++ b/single-email-account.php
@@ -25,6 +25,72 @@ get_header(); ?>
while ( have_posts() ) :
the_post();
+ $post_id = get_the_ID();
+ $domain_id = get_post_meta($post_id, 'domain', true);
+ $domain_post = get_post($domain_id);
+ $full_name = get_post_meta($post_id, 'full_name', true);
+ $email_signature = get_post_meta($post_id, 'email_signature', true);
+ $smtp_status = get_post_meta($post_id, 'smtp_status', true);
+ $imap_status = get_post_meta($post_id, 'imap_status', true);
+
+ // Get email messages for this account
+ global $wpdb;
+ $messages_table = $wpdb->prefix . 'rl_mailwarmer_messages';
+
+ // Count total messages
+ $total_messages = $wpdb->get_var($wpdb->prepare(
+ "SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d",
+ $post_id
+ ));
+
+ // Count sent messages
+ $sent_messages = $wpdb->get_var($wpdb->prepare(
+ "SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND status = 'sent'",
+ $post_id
+ ));
+
+ // Count failed messages
+ $failed_messages = $wpdb->get_var($wpdb->prepare(
+ "SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND status = 'failed'",
+ $post_id
+ ));
+
+ // Count pending messages
+ $pending_messages = $wpdb->get_var($wpdb->prepare(
+ "SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND (status = 'new' OR status = 'scheduled')",
+ $post_id
+ ));
+
+ // Calculate delivery rate
+ $delivery_rate = 0;
+ if (($sent_messages + $failed_messages) > 0) {
+ $delivery_rate = round(($sent_messages / ($sent_messages + $failed_messages)) * 100, 1);
+ }
+
+ // Get upcoming messages (next 7 days)
+ $today = current_time('Y-m-d');
+ $next_week = date('Y-m-d', strtotime('+7 days'));
+ $upcoming_messages = $wpdb->get_results($wpdb->prepare(
+ "SELECT id, scheduled_for_timestamp, from_email, to_email, subject
+ FROM $messages_table
+ WHERE email_account_id = %d
+ AND (status = 'new' OR status = 'scheduled')
+ AND scheduled_for_timestamp BETWEEN %s AND %s
+ ORDER BY scheduled_for_timestamp ASC
+ LIMIT 20",
+ $post_id, $today, $next_week
+ ));
+
+ // Recently sent or failed messages
+ $recent_messages = $wpdb->get_results($wpdb->prepare(
+ "SELECT id, scheduled_for_timestamp, from_email, to_email, subject, status
+ FROM $messages_table
+ WHERE email_account_id = %d
+ AND (status = 'sent' OR status = 'failed')
+ ORDER BY scheduled_for_timestamp DESC
+ LIMIT 20",
+ $post_id
+ ));
?>
@@ -53,8 +119,13 @@ get_header(); ?>
if ( generate_show_title() ) {
$params = generate_get_the_title_parameters();
-
- the_title( $params['before'], $params['after'] );
+ $edit_url = "/dashboard/email-accounts/edit-email-account?edit={$post_id}";
+
+ echo $params['before']; // Output the title before markup
+ echo '
'; // Begin the link
+ the_title(); // Display the title
+ echo ''; // Close the link
+ echo $params['after']; // Output the title after markup
}
/**
@@ -87,7 +158,153 @@ get_header(); ?>
?>
>
- Hi, Bob.
+
+
+
+
Account Information
+
+
+ | Email Address |
+ |
+
+
+ | Full Name |
+ |
+
+
+ | Domain |
+
+
+
+ post_title); ?>
+
+
+ Not set
+
+ |
+
+
+ | SMTP Status |
+ |
+
+
+ | IMAP Status |
+ |
+
+
+
+
+
Email Signature
+
+
+
+
+
+
+
+
Email Delivery Statistics
+
+
+ | Total Messages |
+ |
+
+
+ | Sent Successfully |
+ |
+
+
+ | Pending Messages |
+ |
+
+
+ | Failed Messages |
+ |
+
+
+ | Delivery Rate |
+ % |
+
+
+
+
+
+
Upcoming Messages (Next 7 Days)
+
+
No upcoming messages scheduled for the next 7 days.
+
+
+
+
+ | Scheduled For |
+ From |
+ To |
+ Subject |
+
+
+
+
+
+ | scheduled_for_timestamp ? esc_html(date('Y-m-d H:i', strtotime($message->scheduled_for_timestamp))) : ''; ?> |
+ from_email ? esc_html($message->from_email) : '[Not Set Yet]'; ?> |
+ to_email ? esc_html($message->to_email) : '[Not Set Yet]'; ?> |
+ subject ? esc_html($message->subject) : '[Not Set Yet]'; ?> |
+
+
+
+
+
+
+
+
+
Recent Messages
+
+
No messages have been sent or failed yet.
+
+
+
+
+ | Date |
+ From |
+ To |
+ Subject |
+ Status |
+
+
+
+
+
+ | scheduled_for_timestamp))); ?> |
+ from_email); ?> |
+ to_email); ?> |
+ subject); ?> |
+
+ status)); ?>
+ |
+
+
+
+
+
+
+
+
+
?>
+
+
+
+
generate_construct_sidebars();
- get_footer();
+ get_footer();
\ No newline at end of file