From eab94608835513e9bcfc20e5687c95fb0ea46f30 Mon Sep 17 00:00:00 2001 From: Sebastien Hattry Date: Wed, 26 May 2021 10:19:31 +0200 Subject: [PATCH] fix bug in "getUserFromTable" add "getUserFromTableByEmail" function --- clients/WPCrm.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/clients/WPCrm.php b/clients/WPCrm.php index 883432c..4c64528 100644 --- a/clients/WPCrm.php +++ b/clients/WPCrm.php @@ -251,6 +251,34 @@ class WPCrm extends ApiV1 } } + /** + * Get a customer from table + * + * @param int $crm_id The customer crm id + * + * @return object|null + */ + public static function getUserFromTable($crm_id) + { + return self::_getWpDB()->get_row( + 'SELECT * FROM `ldc_wp_customers` WHERE `crm_id` = ' . $crm_id + ); + } + + /** + * Get a customer from table by an email + * + * @param int $email The customer email + * + * @return object|null + */ + public static function getUserFromTableByEmail($email) + { + return self::_getWpDB()->get_row( + 'SELECT * FROM `ldc_wp_customers` WHERE `email` = "' . $email . '"' + ); + } + /** * Get a customer from table *