From 0e3bd105b87ddf033ee18ac17e3cf086accbd61a Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Mon, 8 Apr 2024 11:40:48 +0530 Subject: [PATCH] fixed date formate with %ANSWER_X% variable --- mlw_quizmaster2.php | 4 ++-- php/template-variables.php | 13 +++++++++---- readme.txt | 7 ++++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index e3cbafc09..bce07abe1 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,7 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 9.0.0 + * Version: 9.0.1 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ * Plugin URI: https://expresstech.io/ @@ -43,7 +43,7 @@ class MLWQuizMasterNext { * @var string * @since 4.0.0 */ - public $version = '9.0.0'; + public $version = '9.0.1'; /** * QSM Alert Manager Object diff --git a/php/template-variables.php b/php/template-variables.php index 9dbcc19e4..8d2e835b1 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -123,6 +123,7 @@ function qsm_variable_single_question_answer( $content, $mlw_quiz_array ) { function qsm_variable_single_answer( $content, $mlw_quiz_array ) { global $mlwQuizMasterNext,$wpdb; + $quiz_options = $mlwQuizMasterNext->quiz_settings->get_quiz_options(); $quiz_id = is_object( $mlw_quiz_array ) ? $mlw_quiz_array->quiz_id : $mlw_quiz_array['quiz_id']; while ( false !== strpos( $content, '%ANSWER_' ) ) { $question_id = mlw_qmn_get_string_between( $content, '%ANSWER_', '%' ); @@ -136,14 +137,18 @@ function qsm_variable_single_answer( $content, $mlw_quiz_array ) { if ( isset($answers['user_answer']) ) { if ( 13 === intval( $answers['question_type'] ) ) { $answerstr .= $answers['points']; + }elseif ( 12 === intval( $answers['question_type'] ) ) { + $preferred_date_format = isset($quiz_options->preferred_date_format) ? $quiz_options->preferred_date_format : get_option('date_format'); + foreach ( $answers['user_answer'] as $answer ) { + $answerstr = date_i18n( $preferred_date_format, strtotime( $answer ) ); + } }elseif ( 'rich' === $question_settings['answerEditor'] ) { foreach ( $answers['user_answer'] as $answer ) { - $answerstr .= htmlspecialchars_decode($answer); + $answerstr .= htmlspecialchars_decode($answer); } - } - elseif ( 'image' === $question_settings['answerEditor'] ) { + }elseif ( 'image' === $question_settings['answerEditor'] ) { foreach ( $answers['user_answer'] as $answer ) { - $answerstr .= ''; + $answerstr .= ''; } }else { $answerstr .= implode(", ",$answers['user_answer']); diff --git a/readme.txt b/readme.txt index ad07c9c15..22c95a5eb 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q Requires at least: 4.9 Tested up to: 6.5 Requires PHP: 5.4 -Stable tag: 9.0.0 +Stable tag: 9.0.1 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -163,6 +163,11 @@ This is usually a theme conflict. You can [checkout out our common conflict solu 18. Database == Changelog == += 9.0.1 (April 08, 2024) = +* Bug: Fixed date formate with %ANSWER_X% variable +* Bug: Fixed PHP warning with Quiz Block editor +* Enhancement: Checked compatibility with WordPress 6.5 + = 9.0.0 (March 27, 2024) = * Feature: Implemented a minimum length requirement for text-based question types * Feature: Introduced a placeholder option for contact fields