0) { return true; } // Check 2: Valid IP address (IPv4 or IPv6) if (filter_var($aiflt_identifier, FILTER_VALIDATE_IP)) { return true; } return false; } // --- Form Submission Logic --- $aiflt_message = ''; $aiflt_message_type = 'success'; // Can be 'success' or 'error' $aiflt_identifier = ''; if ($aiflt_is_wc_active && isset($_POST['aiflt_privacy_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['aiflt_privacy_nonce'])), 'aiflt_privacy_actions')) { $aiflt_identifier = isset($_POST['identifier']) ? sanitize_text_field($_POST['identifier']) : ''; if (!empty($aiflt_identifier)) { // --- NEW VALIDATION CHECK --- if (!aiflt_is_valid_identifier($aiflt_identifier)) { $aiflt_message = esc_html__('Error: Please enter a valid User ID (number) or a valid IP Address.', 'ai-flash-tune'); $aiflt_message_type = 'error'; } else { // Handle Delete Action if (isset($_POST['delete_data'])) { // Ensure class name AIFLT_Privacy_Logic is used (as refactored) $aiflt_deleted_rows = AIFLT_Privacy_Logic::delete_data_by_identifier($aiflt_identifier); $aiflt_total_deleted = (int) ($aiflt_deleted_rows['funnel_data'] ?? 0) + (int) ($aiflt_deleted_rows['behavior_data'] ?? 0); // --- NEW MESSAGE LOGIC (Fix 2) --- if ($aiflt_total_deleted > 0) { $aiflt_message = esc_html__('Successfully deleted ', 'ai-flash-tune') . $aiflt_total_deleted . esc_html__(' record(s) associated with the identifier', 'ai-flash-tune') . ' "' . esc_html($aiflt_identifier) . '".'; $aiflt_message_type = 'success'; } else { $aiflt_message = esc_html__('No record(s) found for the identifier. No data was deleted.', 'ai-flash-tune'); $aiflt_message_type = 'error'; // Indicate failure to delete (no records found) } } // Handle Export Action (Note: this action will exit the script to force a file download) if (isset($_POST['export_data'])) { // Ensure class name AIFLT_Privacy_Logic is used (as refactored) AIFLT_Privacy_Logic::export_data_by_identifier($aiflt_identifier); } } // End of valid identifier check } else { $aiflt_message = esc_html__('Error: Please enter a User ID or IP Address to search for.', 'ai-flash-tune'); $aiflt_message_type = 'error'; } } ?> FIX: The wrapper and sidebar include were missing. They are now restored. ?>

  • prefix . 'aiflt_funnel_data'); ?>

    `user_id`, `ip_address`

  • prefix . 'aiflt_behavior_data'); ?>

    `user_id`, `ip_address`