From eaa45c4ed1ce2ecc20d79a149e116510c00f1453 Mon Sep 17 00:00:00 2001 From: asus Date: Sun, 17 Mar 2024 14:52:42 +0100 Subject: [PATCH] custer format output works with numbers --- plugins/cipf_plugin/php/register_partenaires.php | 6 ------ plugins/custer/format_user_infos.php | 12 ++++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/cipf_plugin/php/register_partenaires.php b/plugins/cipf_plugin/php/register_partenaires.php index c21eddb..5832994 100644 --- a/plugins/cipf_plugin/php/register_partenaires.php +++ b/plugins/cipf_plugin/php/register_partenaires.php @@ -16,12 +16,6 @@ if (!defined('ABSPATH')) { function add_partenaires_CIPF($customer_data){ PLGNTLS_class::debug_infos(); $role_partner = PLGNTLS_class::ROLE_PARTNER; - error_log("----"); - error_log("in add_partenaires"); - error_log("_POST"); - error_log(json_encode($_POST)); - error_log("_SERVER"); - error_log(json_encode($_SERVER)); $current_url = $_SERVER['HTTP_REFERER']; // not reliable to use referer, TODO: find another solution $path_brut = parse_url($current_url, PHP_URL_PATH); diff --git a/plugins/custer/format_user_infos.php b/plugins/custer/format_user_infos.php index c542fbc..6f2abd3 100644 --- a/plugins/custer/format_user_infos.php +++ b/plugins/custer/format_user_infos.php @@ -15,10 +15,15 @@ if (!defined('ABSPATH')) { * */ function return_result($output) { - if (is_array($output) && count($output) === 0) + if (is_array($output) && count($output) === 0) { $output = ''; - if (!is_string($output)) + } + if (is_numeric($output)) { + $output = (string)$output; + } + if (!is_string($output)) { $output = json_encode($output, JSON_UNESCAPED_SLASHES); + } return esc_html($output); } @@ -45,8 +50,7 @@ function format_user_info($query, &$current_user, $user_id) { /* - * check if it's an acf field, and a date - * second method : check what get_field_object() returns + * check if it's an acf field * */ $acf_id = 'user_'.$user_id;