private function render_inline_history_page() { global $wpdb; // Handle export request if (isset($_POST['export_conversations'])) { $this->handle_export_request(); return; } // Get recent conversations with more details $conversations = $wpdb->get_results( "SELECT session_id, user_id, user_email, MAX(timestamp) as last_activity, MIN(timestamp) as started_at, COUNT(*) as message_count, ip_address, (SELECT message FROM {$this->table_name} s2 WHERE s2.session_id = s1.session_id AND s2.message_type = 'user' ORDER BY timestamp ASC LIMIT 1) as first_message FROM {$this->table_name} s1 GROUP BY session_id ORDER BY last_activity DESC LIMIT 50", ARRAY_A ); // Get basic stats $total_conversations = $wpdb->get_var("SELECT COUNT(DISTINCT session_id) FROM {$this->table_name}"); $total_messages = $wpdb->get_var("SELECT COUNT(*) FROM {$this->table_name}"); $conversations_today = $wpdb->get_var("SELECT COUNT(DISTINCT session_id) FROM {$this->table_name} WHERE DATE(timestamp) = CURDATE()"); ?>

Chat History

0

Total Conversations

0

Total Messages

0

Today's Conversations

0

Avg Messages/Chat

Export Data

Export conversation data to CSV file for analysis.

Recent Conversations

Session ID User First Message Messages Started Actions

No conversations found yet.

Once users start chatting, their conversations will appear here.