Multisite Bug in get_home_page_analytics_data
-
We’re getting this error in the logs running Cartflows on WordPress with multisite active:
WordPress database error Table 'kursopro.wp_il_145_users' doesn't exist for query SELECT DATE_FORMAT(orders.date_created_gmt, '%Y-%m-%d') AS OrderDate,
SUM(meta_price.meta_value) AS Revenue
FROM wp_il_145_woocommerce_order_items AS items
JOIN wp_il_145_woocommerce_order_itemmeta AS meta
ON items.order_item_id = meta.order_item_id
JOIN wp_il_145_woocommerce_order_itemmeta AS meta_price
ON items.order_item_id = meta_price.order_item_id
JOIN wp_il_145_wc_orders AS orders
ON items.order_id = orders.id
JOIN wp_il_145_wc_orders AS p
ON orders.id = p.id
JOIN wp_il_145_users AS u
ON p.customer_id = u.ID
WHERE (meta.meta_key LIKE '%\\_cartflows\\_upsell' OR meta.meta_key LIKE '%\\_cartflows\\_downsell')
AND meta_price.meta_key = '_line_subtotal'
AND orders.type = 'shop_order'
AND orders.status IN ('wc-completed', 'wc-processing')
AND orders.date_created_gmt >= '2025-10-03 00:00:00'
AND orders.date_created_gmt < '2025-10-10 23:59:59'
GROUP BY OrderDate made by do_action('wp_ajax_cartflows_get_all_flows_stats'), WP_Hook->do_action, WP_Hook->apply_filters, CartflowsAdmin\AdminCore\Ajax\FlowsStats->get_all_flows_stats, CartflowsAdmin\AdminCore\Inc\AdminHelper::get_earnings, apply_filters('cartflows_home_page_analytics'), WP_Hook->apply_filters, Cartflows_Pro_Analytics_Reports->get_home_page_analytics_dataThis is because Multisite uses only one users table for all subsites and the prefix is not the same.
It’s a simple fix in line 217 of cartflows-pro/modules/tracking/class-cartflows-pro-analytics-reports.php. Change:
$user_table = $wpdb->prefix . 'users';To:
$user_table = $wpdb->users;The users property will always have the correct table name for the users table.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.