Skip to content

Commit

Permalink
Added hook for save result page and merge dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
etchirag committed Sep 13, 2024
2 parents 523479f + 711140e commit e2bf8f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3773,6 +3773,7 @@ var import_button;
})
.done(function (results) {
if (results.status) {
jQuery(document).trigger('qsm_after_save_results');
QSMAdmin.displayAlert(qsm_admin_messages.results_page_saved, 'success');
} else {
QSMAdmin.displayAlert( qsm_admin_messages.results_page_save_error + ' ' + qsm_admin_messages.results_page_saved, 'error');
Expand Down
2 changes: 1 addition & 1 deletion php/admin/options-page-results-page-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function qsm_options_results_tab_template(){
<p><?php esc_html_e( 'Type', 'quiz-master-next' );?> <span class="qsm-hightlight-text"> / </span> <?php esc_html_e( ' to insert template variables', 'quiz-master-next' ); ?></p>
<?php do_action( 'qsm_result_page_before_redirect_input', $quiz_id, $categories ); ?>
<p><?php esc_html_e( 'Or, redirect the user by entering the URL below:', 'quiz-master-next' ); ?></p>
<input type="text" class="results-page-redirect" value="<# if ( data.redirect && 'undefined' !== data.redirect && 'false' !== data.redirect ) { #>{{ data.redirect }}<# } #>">
<input type="text" class="results-page-redirect" value="<# if ( data.redirect && 'undefined' !== data.redirect && 'false' !== data.redirect) { #>{{ data.redirect }}<# } #>">
<?php do_action( 'qsm_result_page_after', $quiz_id, $categories ); ?>
</div>
</main>
Expand Down
5 changes: 5 additions & 0 deletions php/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ function qsm_generate_fb_header_metadata() {
<?php
}
}
$quiz_id = $mlwQuizMasterNext->quizCreator->get_id();
$featured_image = get_option("quiz_featured_image_$quiz_id");
?>
<link rel="preload" href="<?php echo esc_url($featured_image); ?>" as="image">
<?php
}

add_action( 'wp_head', 'qsm_generate_fb_header_metadata' );
Expand Down
2 changes: 1 addition & 1 deletion php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
if ( isset( $answer['question_type'] ) && in_array( intval( $answer['question_type'] ), $question_with_text_input, true ) ) {
$do_show_wrong = true;
$user_given_answer = '' === $answer[1] ? $quiz_options->no_answer_text : htmlentities( $answer[1] );
$user_given_answer = str_replace( "\n" , "<br>", $user_given_answer );
$user_given_answer = str_replace( "\n" , "<br>", $user_given_answer );
if ( 12 == $answer['question_type'] && ! empty( $answer[1] ) && strtotime( $user_given_answer ) ) {
$preferred_date_format = isset($quiz_options->preferred_date_format) ? $quiz_options->preferred_date_format : get_option('date_format');
$user_given_answer = date_i18n($preferred_date_format, strtotime($user_given_answer));
Expand Down

0 comments on commit e2bf8f8

Please sign in to comment.