From b710fcd5fd449bd5bf1352b263d83ebba6747a22 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Fri, 13 Sep 2024 14:56:13 +0200 Subject: [PATCH] handling rating properly --- includes/api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/api.php b/includes/api.php index 7a96031..91b0e9e 100644 --- a/includes/api.php +++ b/includes/api.php @@ -360,12 +360,13 @@ function lhoist_post_rating(WP_REST_Request $request) $cleanDatas = lhoist_sanitize_ratings_datas($datas); lhoist_check_ratings_datas_formats($cleanDatas); + global $wpdb; $datetime = new DateTime("now", new DateTimeZone('Europe/Brussels')); $ratingsDatas = array( - 'comment' => "super", - 'rating' => 3, + 'rating' => $cleanDatas['note'], + 'comment' => $cleanDatas['comment'] ?? '', 'date' => $datetime->format('Y-m-d H:i:s'), ); $table_name = 'wp_app_ratings';