/** * This method is used to fetch all users from the default customer table to list * them in the SendinBlue PS plugin. */ public static function getCustomers($phone_number = null) { $customer_data = get_users(array('role' => 'customer')); $address_mobilephone = array(); foreach ($customer_data as $customer_detail) { $iso_code = SIB_Model_Country::get_prefix($customer_detail->billing_country); if (count($customer_detail) > 0) { $address_mobilephone[$customer_detail->ID] = array('firstname' => $customer_detail->billing_first_name, 'lastname' => $customer_detail->billing_last_name, 'phone_mobile' => $customer_detail->billing_phone, 'iso_code' => $iso_code); } if ($phone_number != null) { $number = self::checkMobileNumber($customer_detail->billing_phone, $iso_code); if ($phone_number == $number) { return $address_mobilephone[$customer_detail->ID]; } } } if ($phone_number != null) { return "false"; } return $address_mobilephone; }