It looks like you haven\'t set up your CloudFlare API info yet. Click here to save that in your profile and get started!'; } $domain_count = count(get_posts([ 'post_type' => 'domain', 'posts_per_page' => -1, 'status' => 'publish', 'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]] ])); $campaign_count = count(get_posts([ 'post_type' => 'campaign', 'posts_per_page' => -1, 'status' => 'publish', 'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]] ])); $email_account_count = count(get_posts([ 'post_type' => 'email-account', 'posts_per_page' => -1, 'status' => 'publish', 'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]] ])); // Get campaigns for this user $campaigns = get_posts([ "post_type" => "campaign", "posts_per_page" => -1, "status" => "publish", "meta_query" => [['key' => 'owner_id', 'value' => $current_user_id]] ]); // Initialize message counters and delivery stats $messages_today = 0; $messages_this_week = 0; $total_sent = 0; $total_failed = 0; // Get message counts from database global $wpdb; $messages_table = $wpdb->prefix . 'rl_mailwarmer_messages'; // Get campaign IDs $campaign_ids = array(); foreach ($campaigns as $campaign) { $campaign_ids[] = $campaign->ID; } if (!empty($campaign_ids)) { // Convert to comma-separated string for SQL $campaign_ids_str = implode(",", $campaign_ids); // Messages scheduled today $today = date("Y-m-d"); $messages_today = $wpdb->get_var( "SELECT COUNT(*) FROM $messages_table WHERE campaign_id IN ($campaign_ids_str) AND (status = 'new' OR status = 'scheduled') AND DATE(scheduled_for_timestamp) = '$today'" ); // Messages scheduled this week (next 7 days) $week_end = date("Y-m-d", strtotime("+7 days")); $messages_this_week = $wpdb->get_var( "SELECT COUNT(*) FROM $messages_table WHERE campaign_id IN ($campaign_ids_str) AND (status = 'new' OR status = 'scheduled') AND DATE(scheduled_for_timestamp) BETWEEN '$today' AND '$week_end'" ); // Get total sent and failed messages $total_sent = $wpdb->get_var( "SELECT COUNT(*) FROM $messages_table WHERE campaign_id IN ($campaign_ids_str) AND status = 'sent'" ); $total_failed = $wpdb->get_var( "SELECT COUNT(*) FROM $messages_table WHERE campaign_id IN ($campaign_ids_str) AND status = 'failed'" ); } // Calculate delivery rate $delivery_rate = 0; if (($total_sent + $total_failed) > 0) { $delivery_rate = round(($total_sent / ($total_sent + $total_failed)) * 100, 1); } if ( ($cloudflare_email || $cloudflare_key) ) { $onboard_steps[0] = true; } if ($domain_count > 0) { $onboard_steps[1] = true; } if ($email_account_count > 0) { $onboard_steps[2] = true; } if ($campaign_count > 0) { $onboard_steps[3] = true; } // Enqueue styles and scripts for modal wp_enqueue_style('mailferno-modal-style', '/wp-content/plugins/rl-mailwarmer/css/modal.css', array(), '1.0.0'); wp_enqueue_script('dashboard-modal', '/wp-content/plugins/rl-mailwarmer/js/dashboard-modal.js', array('jquery'), '1.0.1', true); wp_localize_script('dashboard-modal', 'dashboard_modal_vars', array( 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('dashboard_modal_nonce'), )); get_header(); ?>
>
>