From 4769d27415cb7358882221c0921ef949c29ef243 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 12 Jan 2015 17:18:17 +0000 Subject: [PATCH] Added missing global $wpdb; --- includes/wc-user-functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/wc-user-functions.php b/includes/wc-user-functions.php index 5a0817d4f58..a1a231594f1 100644 --- a/includes/wc-user-functions.php +++ b/includes/wc-user-functions.php @@ -473,6 +473,8 @@ function wc_get_customer_available_downloads( $customer_id ) { */ function wc_get_customer_total_spent( $user_id ) { if ( ! $spent = get_user_meta( $user_id, '_money_spent', true ) ) { + global $wpdb; + $spent = $wpdb->get_var( "SELECT SUM(meta2.meta_value) FROM $wpdb->posts as posts @@ -499,6 +501,8 @@ function wc_get_customer_total_spent( $user_id ) { */ function wc_get_customer_order_count( $user_id ) { if ( ! $count = get_user_meta( $user_id, '_order_count', true ) ) { + global $wpdb; + $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts as posts