From 14267660da1cf5b73934875920d9d951dc530e14 Mon Sep 17 00:00:00 2001 From: Remi Corson Date: Fri, 4 Apr 2014 09:38:56 +0200 Subject: [PATCH] Added is_paying_customer() to easily check if a user is a WC customer: Usage: ` $customer = new WC_Customer(); $out = 'Paying customer ? '; if( $customer->is_paying_customer( 10 ) ) { $out .= "yes"; } else { $out .= "no"; } echo $out; ` --- includes/class-wc-customer.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/includes/class-wc-customer.php b/includes/class-wc-customer.php index 6d21b4d6ab2..eb1afb0f967 100644 --- a/includes/class-wc-customer.php +++ b/includes/class-wc-customer.php @@ -188,6 +188,22 @@ class WC_Customer { } return false; } + + /** + * Is the user a paying customer? + * + * @access public + * @return bool + */ + function is_paying_customer( $user_id ) { + + $paying_customer = get_user_meta( $user_id, 'paying_customer', true ); + if( $paying_customer != '' && absint( $paying_customer ) > 0) { + return true; + } + + return false; + } /**