Version Description
(April 20, 2020)= * Bug: Changed the quiz post type slug to solve the conflict with LMS plugin * Feature: Added the button to remove the result data permanent * Feature: Added supporting code for new advanced timer * Feature: Option to select categories for random questions * Enhancement: JavaScript error messages will show up only for WordPress admins.
Download this release
Release Info
Developer | expresstech |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 6.4.8 |
Comparing to | |
See all releases |
Code changes from version 6.4.7 to 6.4.8
- css/common.css +6 -0
- js/admin.js +4 -0
- js/qsm-quiz.js +64 -23
- mlw_quizmaster2.php +4 -4
- php/admin/admin-results-page.php +22 -13
- php/admin/functions.php +37 -4
- php/admin/quiz-options-page.php +1 -1
- php/admin/quizzes-page.php +3 -3
- php/admin/tools-page.php +1 -1
- php/classes/class-qmn-quiz-creator.php +3 -3
- php/classes/class-qmn-quiz-manager.php +13 -4
- php/classes/class-qsm-fields.php +47 -0
- php/classes/class-qsm-install.php +12 -1
- php/shortcodes.php +29 -8
- readme.txt +8 -1
- uninstall.php +1 -1
css/common.css
CHANGED
@@ -68,6 +68,12 @@
|
|
68 |
.qsm-deselect-answer{
|
69 |
float: right;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
@media screen and (max-width: 767px){
|
72 |
.question-type-polar-s .left-polar-title,
|
73 |
.question-type-polar-s .slider-main-wrapper,
|
68 |
.qsm-deselect-answer{
|
69 |
float: right;
|
70 |
}
|
71 |
+
.qsm-popup__close {
|
72 |
+
text-decoration: none !important;
|
73 |
+
}
|
74 |
+
.qsm-popup__btn-primary{
|
75 |
+
margin-right: 30px;
|
76 |
+
}
|
77 |
@media screen and (max-width: 767px){
|
78 |
.question-type-polar-s .left-polar-title,
|
79 |
.question-type-polar-s .slider-main-wrapper,
|
js/admin.js
CHANGED
@@ -107,5 +107,9 @@ var QSMAdmin;
|
|
107 |
if(jQuery('.buttonset').length > 0){
|
108 |
jQuery('.buttonset').buttonset();
|
109 |
}
|
|
|
|
|
|
|
|
|
110 |
});
|
111 |
}(jQuery));
|
107 |
if(jQuery('.buttonset').length > 0){
|
108 |
jQuery('.buttonset').buttonset();
|
109 |
}
|
110 |
+
jQuery('.category_selection_random').change(function(){
|
111 |
+
var checked_data = jQuery(this).val().toString();
|
112 |
+
jQuery('.catergory_comma_values').val(checked_data);
|
113 |
+
});
|
114 |
});
|
115 |
}(jQuery));
|
js/qsm-quiz.js
CHANGED
@@ -55,14 +55,24 @@ var QSM;
|
|
55 |
} else {
|
56 |
QSM.activateTimer( quizID );
|
57 |
}
|
|
|
58 |
// ...else, we must be using the questions per page option.
|
59 |
} else {
|
60 |
if ( qmn_quiz_data[quizID].hasOwnProperty('pagination') && qmn_quiz_data[quizID].first_page ) {
|
61 |
$( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.mlw_next' ).on( 'click', function(event) {
|
62 |
event.preventDefault();
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
});
|
67 |
} else {
|
68 |
QSM.activateTimer( quizID );
|
@@ -92,7 +102,10 @@ var QSM;
|
|
92 |
seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
93 |
}
|
94 |
qmn_quiz_data[ quizID ].timerRemaning = seconds;
|
95 |
-
|
|
|
|
|
|
|
96 |
// Makes the timer appear.
|
97 |
$timer.show();
|
98 |
$timer.text( QSM.secondsToTimer( seconds ) );
|
@@ -121,7 +134,28 @@ var QSM;
|
|
121 |
var $timer = QSM.getTimer( quizID );
|
122 |
$timer.text( display );
|
123 |
document.title = display + ' ' + qsmTitleText;
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
// If timer is run out, disable fields.
|
126 |
if ( 0 >= secondsRemaining ) {
|
127 |
clearInterval( qmn_quiz_data[ quizID ].timerInterval );
|
@@ -131,15 +165,14 @@ var QSM;
|
|
131 |
$( ".mlw_qmn_question_comment" ).attr( 'disabled', true );
|
132 |
$( ".mlw_answer_open_text" ).attr( 'disabled', true );
|
133 |
$( ".mlw_answer_number" ).attr( 'disabled', true );
|
134 |
-
|
135 |
-
var $quizForm = QSM.getQuizForm( quizID );
|
136 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
137 |
$quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
|
138 |
//$( ".qsm-submit-btn" ).remove();
|
139 |
if(qmn_ajax_object.enable_result_after_timer_end == 1){
|
140 |
$quizForm.closest( '.qmn_quiz_container' ).find('form').submit();
|
141 |
}else{
|
142 |
-
|
143 |
}
|
144 |
//document.quizForm.submit();
|
145 |
return;
|
@@ -656,16 +689,16 @@ function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
|
|
656 |
qsmScrollTo( $container );
|
657 |
}
|
658 |
var page_number = slide_number - pagination;
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
|
|
666 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
667 |
-
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
668 |
-
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
669 |
}else{
|
670 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
671 |
}
|
@@ -719,18 +752,18 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
|
|
719 |
qsmScrollTo( $container );
|
720 |
}
|
721 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
727 |
if(page_number == 0){
|
728 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
729 |
}else{
|
730 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
731 |
-
}
|
732 |
-
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
733 |
}
|
|
|
734 |
}
|
735 |
|
736 |
function qmnUpdatePageNumber( amount, quiz_form_id ) {
|
@@ -951,6 +984,14 @@ jQuery(function() {
|
|
951 |
e.preventDefault();
|
952 |
jQuery(this).parents('.quiz_section').find('input[type="radio"]').prop('checked', false);
|
953 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
954 |
});
|
955 |
|
956 |
var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
|
55 |
} else {
|
56 |
QSM.activateTimer( quizID );
|
57 |
}
|
58 |
+
$( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.stoptimer-p').show();
|
59 |
// ...else, we must be using the questions per page option.
|
60 |
} else {
|
61 |
if ( qmn_quiz_data[quizID].hasOwnProperty('pagination') && qmn_quiz_data[quizID].first_page ) {
|
62 |
$( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.mlw_next' ).on( 'click', function(event) {
|
63 |
event.preventDefault();
|
64 |
+
if(qmn_quiz_data[quizID].hasOwnProperty('advanced_timer')){
|
65 |
+
var start_timer = parseInt(qmn_quiz_data[quizID].advanced_timer.start_timer_page);
|
66 |
+
|
67 |
+
if( $( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.qmn_pagination > .current_page_hidden').val() == start_timer){
|
68 |
+
QSM.activateTimer( quizID );
|
69 |
+
$( '#quizForm' + quizID ).closest( '.qmn_quiz_container' ).find( '.stoptimer-p').show();
|
70 |
+
}
|
71 |
+
}else{
|
72 |
+
if ( ! qmn_quiz_data[ quizID ].timerStatus && ( 0 == $( '.quiz_begin:visible' ).length || ( 1 == $( '.quiz_begin:visible' ).length && qmnValidatePage( 'quizForm' + quizID ) ) ) ) {
|
73 |
+
QSM.activateTimer( quizID );
|
74 |
+
}
|
75 |
+
}
|
76 |
});
|
77 |
} else {
|
78 |
QSM.activateTimer( quizID );
|
102 |
seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
103 |
}
|
104 |
qmn_quiz_data[ quizID ].timerRemaning = seconds;
|
105 |
+
|
106 |
+
//hidden timer
|
107 |
+
jQuery(".hiddentimer").html(seconds);
|
108 |
+
|
109 |
// Makes the timer appear.
|
110 |
$timer.show();
|
111 |
$timer.text( QSM.secondsToTimer( seconds ) );
|
134 |
var $timer = QSM.getTimer( quizID );
|
135 |
$timer.text( display );
|
136 |
document.title = display + ' ' + qsmTitleText;
|
137 |
+
|
138 |
+
/*CUSTOM TIMER*/
|
139 |
+
if(qmn_quiz_data[quizID].hasOwnProperty('advanced_timer') && qmn_quiz_data[quizID].advanced_timer.timer_design == 'big_timer'){
|
140 |
+
$(".second.circle").parent('.mlw_quiz_form').addClass('qsm_big_timer');
|
141 |
+
$(".second.circle").show();
|
142 |
+
$(".second.circle strong").html(display);
|
143 |
+
var datashow =( $(".hiddentimer").html() - secondsRemaining ) / $(".hiddentimer").html();
|
144 |
+
$(".second.circle").circleProgress({
|
145 |
+
startAngle: 11,
|
146 |
+
value: datashow,
|
147 |
+
animation: false,
|
148 |
+
fill: {gradient: ["#00bb40", "#00511c"]}
|
149 |
+
});
|
150 |
+
}
|
151 |
+
|
152 |
+
var $quizForm = QSM.getQuizForm( quizID );
|
153 |
+
var total_seconds = parseFloat( qmn_quiz_data[ quizID ].timer_limit ) * 60;
|
154 |
+
var ninety_sec = total_seconds - ( total_seconds * 90 / 100 );
|
155 |
+
if(ninety_sec == secondsRemaining){
|
156 |
+
$quizForm.closest( '.qmn_quiz_container' ).find('.qsm_ninety_warning').fadeIn();
|
157 |
+
}
|
158 |
+
|
159 |
// If timer is run out, disable fields.
|
160 |
if ( 0 >= secondsRemaining ) {
|
161 |
clearInterval( qmn_quiz_data[ quizID ].timerInterval );
|
165 |
$( ".mlw_qmn_question_comment" ).attr( 'disabled', true );
|
166 |
$( ".mlw_answer_open_text" ).attr( 'disabled', true );
|
167 |
$( ".mlw_answer_number" ).attr( 'disabled', true );
|
168 |
+
|
|
|
169 |
$quizForm.closest( '.qmn_quiz_container' ).addClass( 'qsm_timer_ended' );
|
170 |
$quizForm.closest( '.qmn_quiz_container' ).prepend('<p style="color: red;">Quiz time is over</p>');
|
171 |
//$( ".qsm-submit-btn" ).remove();
|
172 |
if(qmn_ajax_object.enable_result_after_timer_end == 1){
|
173 |
$quizForm.closest( '.qmn_quiz_container' ).find('form').submit();
|
174 |
}else{
|
175 |
+
MicroModal.show( 'modal-3' );
|
176 |
}
|
177 |
//document.quizForm.submit();
|
178 |
return;
|
689 |
qsmScrollTo( $container );
|
690 |
}
|
691 |
var page_number = slide_number - pagination;
|
692 |
+
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
693 |
+
if(hiddem_page_number > 0){
|
694 |
+
page_number = parseInt(hiddem_page_number) + 1;
|
695 |
+
}
|
696 |
+
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
697 |
+
var total_page_number = Math.ceil(total_questions / pagination);
|
698 |
+
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
699 |
+
if(page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
700 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
701 |
+
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
|
|
702 |
}else{
|
703 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
704 |
}
|
752 |
qsmScrollTo( $container );
|
753 |
}
|
754 |
var hiddem_page_number = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val();
|
755 |
+
var page_number = parseInt(hiddem_page_number) - 1;
|
756 |
+
var total_questions = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('[class*="question-section-id-"]').length;
|
757 |
+
var total_page_number = Math.ceil(total_questions / pagination);
|
758 |
+
if(hiddem_page_number > 0 && jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').length > 0){
|
759 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').text('').text( page_number + ' out of ' + total_page_number);
|
760 |
if(page_number == 0){
|
761 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
|
762 |
}else{
|
763 |
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').show();
|
764 |
+
}
|
|
|
765 |
}
|
766 |
+
jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
|
767 |
}
|
768 |
|
769 |
function qmnUpdatePageNumber( amount, quiz_form_id ) {
|
984 |
e.preventDefault();
|
985 |
jQuery(this).parents('.quiz_section').find('input[type="radio"]').prop('checked', false);
|
986 |
});
|
987 |
+
|
988 |
+
//Submit the form on popup click
|
989 |
+
jQuery('.submit-the-form').click(function(e){
|
990 |
+
e.preventDefault();
|
991 |
+
var quiz_id = jQuery(this).data('quiz_id');
|
992 |
+
jQuery('#quizForm' + quiz_id ).submit();
|
993 |
+
jQuery('#modal-3').removeClass('is-open');
|
994 |
+
});
|
995 |
});
|
996 |
|
997 |
var qsmTimerInterval = setInterval( qmnTimeTakenTimer, 1000 );
|
mlw_quizmaster2.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
-
* Version: 6.4.
|
6 |
* Author: ExpressTech
|
7 |
* Author URI: https://quizandsurveymaster.com/
|
8 |
* Plugin URI: https://expresstech.io/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author QSM Team
|
12 |
-
* @version 6.4.
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
@@ -37,7 +37,7 @@ class MLWQuizMasterNext {
|
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
-
public $version = '6.4.
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
@@ -259,7 +259,7 @@ class MLWQuizMasterNext {
|
|
259 |
);
|
260 |
|
261 |
// Registers post type.
|
262 |
-
register_post_type( '
|
263 |
}
|
264 |
|
265 |
/**
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
+
* Version: 6.4.8
|
6 |
* Author: ExpressTech
|
7 |
* Author URI: https://quizandsurveymaster.com/
|
8 |
* Plugin URI: https://expresstech.io/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author QSM Team
|
12 |
+
* @version 6.4.8
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
37 |
* @var string
|
38 |
* @since 4.0.0
|
39 |
*/
|
40 |
+
public $version = '6.4.8';
|
41 |
|
42 |
/**
|
43 |
* QSM Alert Manager Object
|
259 |
);
|
260 |
|
261 |
// Registers post type.
|
262 |
+
register_post_type( 'qsm_quiz', $quiz_args );
|
263 |
}
|
264 |
|
265 |
/**
|
php/admin/admin-results-page.php
CHANGED
@@ -125,17 +125,24 @@ function qsm_results_overview_tab_content() {
|
|
125 |
|
126 |
// Santize by ensuring the value is an int
|
127 |
$result_id = intval( $result );
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
$mlwQuizMasterNext->audit_manager->new_audit( "Results Have Been Bulk Deleted" );
|
@@ -220,11 +227,12 @@ function qsm_results_overview_tab_content() {
|
|
220 |
var idHiddenName = document.getElementById("delete_quiz_name");
|
221 |
idHidden.value = id;
|
222 |
idHiddenName.value = quizName;
|
223 |
-
};
|
224 |
</script>
|
225 |
<div class="tablenav top">
|
226 |
<div class="alignleft actions bulkactions">
|
227 |
-
|
|
|
228 |
</div>
|
229 |
<div class="tablenav-pages">
|
230 |
<span class="displaying-num"><?php echo sprintf(_n('One result', '%s results', $qsm_results_count, 'quiz-master-next' ), number_format_i18n($qsm_results_count)); ?></span>
|
@@ -303,6 +311,7 @@ function qsm_results_overview_tab_content() {
|
|
303 |
</form>
|
304 |
<form action="" method="post" name="bulk_delete_form">
|
305 |
<input type="hidden" name="bulk_delete" value="confirmation" />
|
|
|
306 |
<?php wp_nonce_field( 'bulk_delete','bulk_delete_nonce' ); ?>
|
307 |
<table class=widefat>
|
308 |
<thead>
|
125 |
|
126 |
// Santize by ensuring the value is an int
|
127 |
$result_id = intval( $result );
|
128 |
+
if(isset($_POST['bulk_permanent_delete']) && $_POST['bulk_permanent_delete'] == 1){
|
129 |
+
$wpdb->delete(
|
130 |
+
$wpdb->prefix."mlw_results",
|
131 |
+
array( 'result_id' => $result_id )
|
132 |
+
);
|
133 |
+
}else{
|
134 |
+
$wpdb->update(
|
135 |
+
$wpdb->prefix."mlw_results",
|
136 |
+
array(
|
137 |
+
'deleted' => 1,
|
138 |
+
),
|
139 |
+
array( 'result_id' => $result_id ),
|
140 |
+
array(
|
141 |
+
'%d'
|
142 |
+
),
|
143 |
+
array( '%d' )
|
144 |
+
);
|
145 |
+
}
|
146 |
}
|
147 |
|
148 |
$mlwQuizMasterNext->audit_manager->new_audit( "Results Have Been Bulk Deleted" );
|
227 |
var idHiddenName = document.getElementById("delete_quiz_name");
|
228 |
idHidden.value = id;
|
229 |
idHiddenName.value = quizName;
|
230 |
+
};
|
231 |
</script>
|
232 |
<div class="tablenav top">
|
233 |
<div class="alignleft actions bulkactions">
|
234 |
+
<a id="result_bulkaction" href="javascript: void(0);" onclick="if( confirm('Are you sure?') ){ document.bulk_delete_form.submit(); }" class="button action">Bulk Delete</a>
|
235 |
+
<a href="javascript: void(0);" onclick="if( confirm('Are you sure?') ){ document.getElementById('bulk_permanent_delete').value = '1'; document.bulk_delete_form.submit(); }" class="button action">Bulk Permanent Delete</a>
|
236 |
</div>
|
237 |
<div class="tablenav-pages">
|
238 |
<span class="displaying-num"><?php echo sprintf(_n('One result', '%s results', $qsm_results_count, 'quiz-master-next' ), number_format_i18n($qsm_results_count)); ?></span>
|
311 |
</form>
|
312 |
<form action="" method="post" name="bulk_delete_form">
|
313 |
<input type="hidden" name="bulk_delete" value="confirmation" />
|
314 |
+
<input type="hidden" name="bulk_permanent_delete" id="bulk_permanent_delete" value="0" />
|
315 |
<?php wp_nonce_field( 'bulk_delete','bulk_delete_nonce' ); ?>
|
316 |
<table class=widefat>
|
317 |
<thead>
|
php/admin/functions.php
CHANGED
@@ -33,14 +33,47 @@ add_action('admin_init','qsm_add_author_column_in_db');
|
|
33 |
function qsm_add_author_column_in_db(){
|
34 |
global $wpdb;
|
35 |
$quiz_table_name = $wpdb->prefix . "mlw_quizzes";
|
36 |
-
$row = $wpdb->
|
37 |
-
if (
|
38 |
$wpdb->query("ALTER TABLE $quiz_table_name ADD quiz_author_id INT NOT NULL");
|
39 |
}
|
40 |
$result_table_name = $wpdb->prefix . "mlw_results";
|
41 |
-
$row = $wpdb->
|
42 |
-
if (
|
43 |
$wpdb->query("ALTER TABLE $result_table_name ADD unique_id varchar(255) NOT NULL");
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
33 |
function qsm_add_author_column_in_db(){
|
34 |
global $wpdb;
|
35 |
$quiz_table_name = $wpdb->prefix . "mlw_quizzes";
|
36 |
+
$row = $wpdb->get_row("SELECT * FROM $quiz_table_name");
|
37 |
+
if (!isset($row->quiz_author_id)) {
|
38 |
$wpdb->query("ALTER TABLE $quiz_table_name ADD quiz_author_id INT NOT NULL");
|
39 |
}
|
40 |
$result_table_name = $wpdb->prefix . "mlw_results";
|
41 |
+
$row = $wpdb->get_row("SELECT * FROM $result_table_name");
|
42 |
+
if ( !isset($row->unique_id) ) {
|
43 |
$wpdb->query("ALTER TABLE $result_table_name ADD unique_id varchar(255) NOT NULL");
|
44 |
}
|
45 |
|
46 |
+
}
|
47 |
+
|
48 |
+
add_action('admin_init', 'qsm_change_the_post_type');
|
49 |
+
/**
|
50 |
+
* @since version 6.4.8
|
51 |
+
* Transfer all quiz post to new cpt 'qsm_quiz'
|
52 |
+
*/
|
53 |
+
function qsm_change_the_post_type(){
|
54 |
+
if( get_option('qsm_change_the_post_type', '') != '1' ){
|
55 |
+
$post_arr = array(
|
56 |
+
'post_type' => 'quiz',
|
57 |
+
'posts_per_page' => -1,
|
58 |
+
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'trash')
|
59 |
+
);
|
60 |
+
$my_query = new WP_Query( $post_arr );
|
61 |
+
|
62 |
+
if ( $my_query->have_posts() ) {
|
63 |
+
while ( $my_query->have_posts() ) {
|
64 |
+
$my_query->the_post();
|
65 |
+
|
66 |
+
$post_id = get_the_ID();
|
67 |
+
$post_obj = get_post( $post_id );
|
68 |
+
if($post_obj->post_status == 'trash'){
|
69 |
+
$post_obj->post_status = 'draft';
|
70 |
+
}
|
71 |
+
$post_obj->post_type = 'qsm_quiz';
|
72 |
+
wp_update_post( $post_obj );
|
73 |
+
}
|
74 |
+
wp_reset_postdata();
|
75 |
+
}
|
76 |
+
update_option('qsm_change_the_post_type', '1');
|
77 |
+
flush_rewrite_rules();
|
78 |
+
}
|
79 |
}
|
php/admin/quiz-options-page.php
CHANGED
@@ -77,7 +77,7 @@ function qsm_generate_quiz_options() {
|
|
77 |
// Get quiz post based on quiz id
|
78 |
$args = array(
|
79 |
'posts_per_page' => 1,
|
80 |
-
'post_type' => '
|
81 |
'meta_query' => array(
|
82 |
array(
|
83 |
'key' => 'quiz_id',
|
77 |
// Get quiz post based on quiz id
|
78 |
$args = array(
|
79 |
'posts_per_page' => 1,
|
80 |
+
'post_type' => 'qsm_quiz',
|
81 |
'meta_query' => array(
|
82 |
array(
|
83 |
'key' => 'quiz_id',
|
php/admin/quizzes-page.php
CHANGED
@@ -79,7 +79,7 @@ function qsm_generate_quizzes_surveys_page() {
|
|
79 |
|
80 |
//Query for post
|
81 |
$post_arr = array(
|
82 |
-
'post_type' => '
|
83 |
'posts_per_page' => -1,
|
84 |
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private')
|
85 |
);
|
@@ -116,7 +116,7 @@ function qsm_generate_quizzes_surveys_page() {
|
|
116 |
'post_status' => get_post_status(get_the_ID()),
|
117 |
);
|
118 |
}
|
119 |
-
}
|
120 |
wp_reset_postdata();
|
121 |
$quiz_json_array = array();
|
122 |
foreach ( $quizzes as $quiz ) {
|
@@ -127,7 +127,7 @@ function qsm_generate_quizzes_surveys_page() {
|
|
127 |
'post_content' => "[qsm quiz={$quiz->quiz_id}]",
|
128 |
//'post_status' => 'publish',
|
129 |
'post_author' => $current_user->ID,
|
130 |
-
'post_type' => '
|
131 |
);
|
132 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
133 |
add_post_meta( $quiz_post_id, 'quiz_id', $quiz->quiz_id );
|
79 |
|
80 |
//Query for post
|
81 |
$post_arr = array(
|
82 |
+
'post_type' => 'qsm_quiz',
|
83 |
'posts_per_page' => -1,
|
84 |
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private')
|
85 |
);
|
116 |
'post_status' => get_post_status(get_the_ID()),
|
117 |
);
|
118 |
}
|
119 |
+
}
|
120 |
wp_reset_postdata();
|
121 |
$quiz_json_array = array();
|
122 |
foreach ( $quizzes as $quiz ) {
|
127 |
'post_content' => "[qsm quiz={$quiz->quiz_id}]",
|
128 |
//'post_status' => 'publish',
|
129 |
'post_author' => $current_user->ID,
|
130 |
+
'post_type' => 'qsm_quiz',
|
131 |
);
|
132 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
133 |
add_post_meta( $quiz_post_id, 'quiz_id', $quiz->quiz_id );
|
php/admin/tools-page.php
CHANGED
@@ -76,7 +76,7 @@ function qsm_restore_function() {
|
|
76 |
} else {
|
77 |
// Restores the quiz post type for the quiz.
|
78 |
$my_query = new WP_Query( array(
|
79 |
-
'post_type' => '
|
80 |
'meta_key' => 'quiz_id',
|
81 |
'meta_value' => sanitize_text_field( intval( $_POST['restore_quiz'] ) ),
|
82 |
));
|
76 |
} else {
|
77 |
// Restores the quiz post type for the quiz.
|
78 |
$my_query = new WP_Query( array(
|
79 |
+
'post_type' => 'qsm_quiz',
|
80 |
'meta_key' => 'quiz_id',
|
81 |
'meta_value' => sanitize_text_field( intval( $_POST['restore_quiz'] ) ),
|
82 |
));
|
php/classes/class-qmn-quiz-creator.php
CHANGED
@@ -191,7 +191,7 @@ class QMNQuizCreator {
|
|
191 |
'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
|
192 |
'post_status' => 'publish',
|
193 |
'post_author' => $current_user->ID,
|
194 |
-
'post_type' => '
|
195 |
);
|
196 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
197 |
add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
|
@@ -242,7 +242,7 @@ class QMNQuizCreator {
|
|
242 |
);
|
243 |
if ($results != false)
|
244 |
{
|
245 |
-
$my_query = new WP_Query( array('post_type' => '
|
246 |
if( $my_query->have_posts() )
|
247 |
{
|
248 |
while( $my_query->have_posts() )
|
@@ -449,7 +449,7 @@ class QMNQuizCreator {
|
|
449 |
'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
|
450 |
'post_status' => 'publish',
|
451 |
'post_author' => $current_user->ID,
|
452 |
-
'post_type' => '
|
453 |
);
|
454 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
455 |
add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
|
191 |
'post_content' => "[mlw_quizmaster quiz=$new_quiz]",
|
192 |
'post_status' => 'publish',
|
193 |
'post_author' => $current_user->ID,
|
194 |
+
'post_type' => 'qsm_quiz',
|
195 |
);
|
196 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
197 |
add_post_meta( $quiz_post_id, 'quiz_id', $new_quiz );
|
242 |
);
|
243 |
if ($results != false)
|
244 |
{
|
245 |
+
$my_query = new WP_Query( array('post_type' => 'qsm_quiz', 'meta_key' => 'quiz_id', 'meta_value' => $quiz_id) );
|
246 |
if( $my_query->have_posts() )
|
247 |
{
|
248 |
while( $my_query->have_posts() )
|
449 |
'post_content' => "[mlw_quizmaster quiz=$mlw_new_id]",
|
450 |
'post_status' => 'publish',
|
451 |
'post_author' => $current_user->ID,
|
452 |
+
'post_type' => 'qsm_quiz'
|
453 |
);
|
454 |
$quiz_post_id = wp_insert_post( $quiz_post );
|
455 |
add_post_meta( $quiz_post_id, 'quiz_id', $mlw_new_id );
|
php/classes/class-qmn-quiz-manager.php
CHANGED
@@ -282,7 +282,7 @@ class QMNQuizManager {
|
|
282 |
$qmn_filtered_json = apply_filters('qmn_json_data', $qmn_json_data, $qmn_quiz_options, $qmn_array_for_variables);
|
283 |
|
284 |
$return_display .= '<script>
|
285 |
-
window.qmn_quiz_data["' . $qmn_json_data["quiz_id"] . '"] = ' . json_encode($
|
286 |
</script>';
|
287 |
|
288 |
$return_display .= ob_get_clean();
|
@@ -352,8 +352,15 @@ class QMNQuizManager {
|
|
352 |
$limit_sql = '';
|
353 |
|
354 |
// Checks if the questions should be randomized.
|
|
|
355 |
if (1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order) {
|
356 |
$order_by_sql = 'ORDER BY rand()';
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
}
|
358 |
|
359 |
// Check if we should load all questions or only a selcted amount.
|
@@ -376,7 +383,7 @@ class QMNQuizManager {
|
|
376 |
}
|
377 |
}
|
378 |
$question_sql = implode(', ', $question_ids);
|
379 |
-
$questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN ($question_sql) " . $order_by_sql . $limit_sql);
|
380 |
|
381 |
// If we are not using randomization, we need to put the questions in the order of the new question editor.
|
382 |
// If a user has saved the pages in the question editor but still uses the older pagination options
|
@@ -393,7 +400,7 @@ class QMNQuizManager {
|
|
393 |
$questions = $ordered_questions;
|
394 |
}
|
395 |
} else {
|
396 |
-
$questions = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0 " . $order_by_sql . $limit_sql, $quiz_id));
|
397 |
}
|
398 |
|
399 |
// Returns an array of all the loaded questions.
|
@@ -485,6 +492,8 @@ class QMNQuizManager {
|
|
485 |
wp_enqueue_script( 'jquery-ui-slider-rtl-js', plugins_url('../../js/jquery.ui.slider-rtl.js', __FILE__) );
|
486 |
wp_enqueue_style( 'jquery-ui-slider-rtl-css', plugins_url('../../css/jquery.ui.slider-rtl.css', __FILE__) );
|
487 |
wp_enqueue_script( 'jqueryui-touch-js', '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' );
|
|
|
|
|
488 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
489 |
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : ''));
|
490 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
@@ -497,7 +506,7 @@ class QMNQuizManager {
|
|
497 |
// Get quiz post based on quiz id
|
498 |
$args = array(
|
499 |
'posts_per_page' => 1,
|
500 |
-
'post_type' => '
|
501 |
'meta_query' => array(
|
502 |
array(
|
503 |
'key' => 'quiz_id',
|
282 |
$qmn_filtered_json = apply_filters('qmn_json_data', $qmn_json_data, $qmn_quiz_options, $qmn_array_for_variables);
|
283 |
|
284 |
$return_display .= '<script>
|
285 |
+
window.qmn_quiz_data["' . $qmn_json_data["quiz_id"] . '"] = ' . json_encode($qmn_filtered_json) . '
|
286 |
</script>';
|
287 |
|
288 |
$return_display .= ob_get_clean();
|
352 |
$limit_sql = '';
|
353 |
|
354 |
// Checks if the questions should be randomized.
|
355 |
+
$cat_query = '';
|
356 |
if (1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order) {
|
357 |
$order_by_sql = 'ORDER BY rand()';
|
358 |
+
$categories = isset($quiz_options->randon_category) ? $quiz_options->randon_category : '';
|
359 |
+
if($categories){
|
360 |
+
$exploded_arr = explode(',', $quiz_options->randon_category);
|
361 |
+
$cat_str = "'" . implode ( "', '", $exploded_arr ) . "'";
|
362 |
+
$cat_query = " AND category IN ( $cat_str ) ";
|
363 |
+
}
|
364 |
}
|
365 |
|
366 |
// Check if we should load all questions or only a selcted amount.
|
383 |
}
|
384 |
}
|
385 |
$question_sql = implode(', ', $question_ids);
|
386 |
+
$questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}mlw_questions WHERE question_id IN ($question_sql) " . $cat_query . $order_by_sql . $limit_sql);
|
387 |
|
388 |
// If we are not using randomization, we need to put the questions in the order of the new question editor.
|
389 |
// If a user has saved the pages in the question editor but still uses the older pagination options
|
400 |
$questions = $ordered_questions;
|
401 |
}
|
402 |
} else {
|
403 |
+
$questions = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "mlw_questions WHERE quiz_id=%d AND deleted=0 " . $cat_query . $order_by_sql . $limit_sql, $quiz_id));
|
404 |
}
|
405 |
|
406 |
// Returns an array of all the loaded questions.
|
492 |
wp_enqueue_script( 'jquery-ui-slider-rtl-js', plugins_url('../../js/jquery.ui.slider-rtl.js', __FILE__) );
|
493 |
wp_enqueue_style( 'jquery-ui-slider-rtl-css', plugins_url('../../css/jquery.ui.slider-rtl.css', __FILE__) );
|
494 |
wp_enqueue_script( 'jqueryui-touch-js', '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' );
|
495 |
+
wp_enqueue_style('qsm_model_css', plugins_url('../../css/qsm-admin.css', __FILE__));
|
496 |
+
wp_enqueue_script('qsm_model_js', plugins_url('../../js/micromodal.min.js', __FILE__));
|
497 |
wp_enqueue_script('qsm_quiz', plugins_url('../../js/qsm-quiz.js', __FILE__), array('wp-util', 'underscore', 'jquery', 'jquery-ui-tooltip', 'progress-bar'), $mlwQuizMasterNext->version);
|
498 |
wp_localize_script('qsm_quiz', 'qmn_ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'), 'enable_quick_result_mc' => isset($options->enable_quick_result_mc) ? $options->enable_quick_result_mc : '','enable_result_after_timer_end' => isset($options->enable_result_after_timer_end) ? $options->enable_result_after_timer_end : ''));
|
499 |
wp_enqueue_script( 'math_jax', '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML' );
|
506 |
// Get quiz post based on quiz id
|
507 |
$args = array(
|
508 |
'posts_per_page' => 1,
|
509 |
+
'post_type' => 'qsm_quiz',
|
510 |
'meta_query' => array(
|
511 |
array(
|
512 |
'key' => 'quiz_id',
|
php/classes/class-qsm-fields.php
CHANGED
@@ -268,6 +268,53 @@ class QSM_Fields {
|
|
268 |
</tr>
|
269 |
<?php
|
270 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
|
273 |
?>
|
268 |
</tr>
|
269 |
<?php
|
270 |
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Generates category checkbox
|
274 |
+
*
|
275 |
+
* @since 6.4.8
|
276 |
+
* @param array $field The array that contains the data for the input field
|
277 |
+
* @param mixed $value The current value of the setting
|
278 |
+
*/
|
279 |
+
public static function generate_category_field( $field, $value ) {
|
280 |
+
global $wpdb;
|
281 |
+
$quiz_id = isset($_GET['quiz_id']) ? $_GET['quiz_id'] : 0;
|
282 |
+
$explode_cat = explode(',', $value);
|
283 |
+
?>
|
284 |
+
<tr valign="top">
|
285 |
+
<th scope="row"><label for="<?php echo $field["id"]; ?>"><?php echo $field["label"]; ?></label></th>
|
286 |
+
<td>
|
287 |
+
<?php
|
288 |
+
$questions = QSM_Questions::load_questions_by_pages( $quiz_id );
|
289 |
+
$cat_array = array();
|
290 |
+
if($questions){
|
291 |
+
foreach( $questions as $single_question ){
|
292 |
+
$cat_array[] = $single_question['category'];
|
293 |
+
}
|
294 |
+
$cat_array = array_unique($cat_array);
|
295 |
+
if($cat_array){
|
296 |
+
?>
|
297 |
+
<select class="category_selection_random" multiple="">
|
298 |
+
<option value="">Select Categories</option>
|
299 |
+
<?php
|
300 |
+
foreach( $cat_array as $single_cat ){ ?>
|
301 |
+
<option <?php if( in_array($single_cat, $explode_cat) ){ echo "selected"; } ?> value="<?php echo $single_cat; ?>"><?php echo $single_cat; ?></option>
|
302 |
+
<?php
|
303 |
+
} ?>
|
304 |
+
</select>
|
305 |
+
<?php
|
306 |
+
}else{
|
307 |
+
echo 'No catergory found.';
|
308 |
+
}
|
309 |
+
}else{
|
310 |
+
echo 'No catergory found.';
|
311 |
+
}
|
312 |
+
?>
|
313 |
+
<input type="hidden" class="catergory_comma_values" name="<?php echo $field["id"]; ?>" value='<?php echo $value; ?>'>
|
314 |
+
</td>
|
315 |
+
</tr>
|
316 |
+
<?php
|
317 |
+
}
|
318 |
}
|
319 |
|
320 |
?>
|
php/classes/class-qsm-install.php
CHANGED
@@ -231,7 +231,16 @@ class QSM_Install {
|
|
231 |
'default' => 0
|
232 |
);
|
233 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
// Registers contact_info_location setting
|
236 |
$field_array = array(
|
237 |
'id' => 'contact_info_location',
|
@@ -989,6 +998,7 @@ class QSM_Install {
|
|
989 |
quiz_views INT NOT NULL,
|
990 |
quiz_taken INT NOT NULL,
|
991 |
deleted INT NOT NULL,
|
|
|
992 |
PRIMARY KEY (quiz_id)
|
993 |
) $charset_collate;";
|
994 |
|
@@ -1051,6 +1061,7 @@ class QSM_Install {
|
|
1051 |
time_taken_real DATETIME NOT NULL,
|
1052 |
quiz_results MEDIUMTEXT NOT NULL,
|
1053 |
deleted INT NOT NULL,
|
|
|
1054 |
PRIMARY KEY (result_id)
|
1055 |
) $charset_collate;";
|
1056 |
|
231 |
'default' => 0
|
232 |
);
|
233 |
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
234 |
+
|
235 |
+
// Registers category setting
|
236 |
+
$field_array = array(
|
237 |
+
'id' => 'randon_category',
|
238 |
+
'label' => __('Select category for random question', 'quiz-master-next'),
|
239 |
+
'type' => 'category',
|
240 |
+
'default' => ''
|
241 |
+
);
|
242 |
+
$mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
|
243 |
+
|
244 |
// Registers contact_info_location setting
|
245 |
$field_array = array(
|
246 |
'id' => 'contact_info_location',
|
998 |
quiz_views INT NOT NULL,
|
999 |
quiz_taken INT NOT NULL,
|
1000 |
deleted INT NOT NULL,
|
1001 |
+
quiz_author_id INT NOT NULL,
|
1002 |
PRIMARY KEY (quiz_id)
|
1003 |
) $charset_collate;";
|
1004 |
|
1061 |
time_taken_real DATETIME NOT NULL,
|
1062 |
quiz_results MEDIUMTEXT NOT NULL,
|
1063 |
deleted INT NOT NULL,
|
1064 |
+
unique_id varchar(255) NOT NULL,
|
1065 |
PRIMARY KEY (result_id)
|
1066 |
) $charset_collate;";
|
1067 |
|
php/shortcodes.php
CHANGED
@@ -18,7 +18,7 @@ function qsm_quiz_link_shortcode($atts, $content = '') {
|
|
18 |
|
19 |
// Find the permalink by finding the post with the meta_key 'quiz_id' of supplied quiz
|
20 |
$permalink = '';
|
21 |
-
$my_query = new WP_Query(array('post_type' => '
|
22 |
if ($my_query->have_posts()) {
|
23 |
while ($my_query->have_posts()) {
|
24 |
$my_query->the_post();
|
@@ -190,19 +190,20 @@ add_action('wp_head', 'qsm_generate_fb_header_metadata');
|
|
190 |
|
191 |
|
192 |
add_action('wp_head', 'qsm_check_script_error');
|
193 |
-
|
|
|
|
|
|
|
194 |
function qsm_check_script_error() {
|
195 |
-
if (is_singular('
|
196 |
?>
|
197 |
<script src="<?php echo QSM_PLUGIN_URL . 'js/show-js-error.custom.js'; ?>"></script>
|
198 |
<link rel='stylesheet' href='<?php echo QSM_PLUGIN_URL . 'css/show-js-error.css'; ?>' type='text/css' media='all' />
|
199 |
<script>
|
200 |
//Display JS error
|
201 |
showJSError.init({
|
202 |
-
title: 'Javascript error detected by QSM Plugin',
|
203 |
-
copyText: 'Copy to clipboard',
|
204 |
-
sendText: 'Create Issue',
|
205 |
-
sendUrl: 'https://github.com/QuizandSurveyMaster/quiz_master_next/issues/new?title={title}&body={body}',
|
206 |
userAgent: navigator.userAgent,
|
207 |
helpLinks: true
|
208 |
});
|
@@ -220,7 +221,7 @@ function qsm_check_script_error() {
|
|
220 |
function qsm_get_post_id_from_quiz_id($quiz_id){
|
221 |
$args = array(
|
222 |
'posts_per_page' => 1,
|
223 |
-
'post_type' => '
|
224 |
'meta_query' => array(
|
225 |
array(
|
226 |
'key' => 'quiz_id',
|
@@ -242,4 +243,24 @@ function qsm_get_post_id_from_quiz_id($quiz_id){
|
|
242 |
wp_reset_postdata();
|
243 |
}
|
244 |
return $post_permalink;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
18 |
|
19 |
// Find the permalink by finding the post with the meta_key 'quiz_id' of supplied quiz
|
20 |
$permalink = '';
|
21 |
+
$my_query = new WP_Query(array('post_type' => 'qsm_quiz', 'meta_key' => 'quiz_id', 'meta_value' => $id, 'posts_per_page' => 1, 'post_status' => 'publish'));
|
22 |
if ($my_query->have_posts()) {
|
23 |
while ($my_query->have_posts()) {
|
24 |
$my_query->the_post();
|
190 |
|
191 |
|
192 |
add_action('wp_head', 'qsm_check_script_error');
|
193 |
+
/**
|
194 |
+
* @since 6.4.8
|
195 |
+
* Show the JS error
|
196 |
+
*/
|
197 |
function qsm_check_script_error() {
|
198 |
+
if (is_singular('qsm_quiz') && is_user_logged_in() && current_user_can('administrator')) {
|
199 |
?>
|
200 |
<script src="<?php echo QSM_PLUGIN_URL . 'js/show-js-error.custom.js'; ?>"></script>
|
201 |
<link rel='stylesheet' href='<?php echo QSM_PLUGIN_URL . 'css/show-js-error.css'; ?>' type='text/css' media='all' />
|
202 |
<script>
|
203 |
//Display JS error
|
204 |
showJSError.init({
|
205 |
+
title: 'Javascript error detected by QSM Plugin. Try deactivating other plugins and themes. If the error still persists, please report the same on our support forums',
|
206 |
+
copyText: 'Copy to clipboard',
|
|
|
|
|
207 |
userAgent: navigator.userAgent,
|
208 |
helpLinks: true
|
209 |
});
|
221 |
function qsm_get_post_id_from_quiz_id($quiz_id){
|
222 |
$args = array(
|
223 |
'posts_per_page' => 1,
|
224 |
+
'post_type' => 'qsm_quiz',
|
225 |
'meta_query' => array(
|
226 |
array(
|
227 |
'key' => 'quiz_id',
|
243 |
wp_reset_postdata();
|
244 |
}
|
245 |
return $post_permalink;
|
246 |
+
}
|
247 |
+
|
248 |
+
add_filter('qmn_end_shortcode', 'qsm_display_popup_div', 10, 3);
|
249 |
+
function qsm_display_popup_div( $return_display, $qmn_quiz_options, $qmn_array_for_variables ){
|
250 |
+
if($qmn_quiz_options->enable_result_after_timer_end == 0){
|
251 |
+
$return_display .= '<div class="qsm-popup qsm-popup-slide" id="modal-3" aria-hidden="false">';
|
252 |
+
$return_display .= '<div class="qsm-popup__overlay" tabindex="-1" data-micromodal-close="">';
|
253 |
+
$return_display .= '<div class="qsm-popup__container" role="dialog" aria-modal="true" aria-labelledby="modal-3-title">';
|
254 |
+
$return_display .= '<header class="qsm-popup__header">';
|
255 |
+
$return_display .= '<h2 class="qsm-popup__title" id="modal-3-title">Alert!</h2><a class="qsm-popup__close" aria-label="Close modal" data-micromodal-close=""></a>';
|
256 |
+
$return_display .= '</header>';
|
257 |
+
$return_display .= '<main class="qsm-popup__content" id="modal-3-content">';
|
258 |
+
$return_display .= '<p>You are not able to attemp remaining part of quiz but you can submit the quiz!</p>';
|
259 |
+
$return_display .= '</main>';
|
260 |
+
$return_display .= '<footer class="qsm-popup__footer"><button data-quiz_id="'. $qmn_quiz_options->quiz_id .'" class="submit-the-form qsm-popup__btn qsm-popup__btn-primary">Submit</button><button class="qsm-popup__btn" data-micromodal-close="" aria-label="Close this dialog window">Cancel</button></footer>';
|
261 |
+
$return_display .= '</div>';
|
262 |
+
$return_display .= '</div>';
|
263 |
+
$return_display .= '</div>';
|
264 |
+
}
|
265 |
+
return $return_display;
|
266 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q
|
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 6.4.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -121,6 +121,13 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
= 6.4.7 (April 07, 2020)=
|
125 |
* Bug: Solved jquery UI error
|
126 |
* Bug: Customized text using the "Text tab" and remove from "Options Tab" for user is not logged in
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 6.4.8
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 6.4.8 (April 20, 2020)=
|
125 |
+
* Bug: Changed the quiz post type slug to solve the conflict with LMS plugin
|
126 |
+
* Feature: Added the button to remove the result data permanent
|
127 |
+
* Feature: Added supporting code for new advanced timer
|
128 |
+
* Feature: Option to select categories for random questions
|
129 |
+
* Enhancement: JavaScript error messages will show up only for WordPress admins.
|
130 |
+
|
131 |
= 6.4.7 (April 07, 2020)=
|
132 |
* Bug: Solved jquery UI error
|
133 |
* Bug: Customized text using the "Text tab" and remove from "Options Tab" for user is not logged in
|
uninstall.php
CHANGED
@@ -24,7 +24,7 @@ $results = $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
|
|
24 |
|
25 |
// Taken from Easy Digital Downloads. Much better way of doing it than I was doing :)
|
26 |
// Cycle through custom post type array, retreive all posts, delete each one.
|
27 |
-
$qsm_post_types = array( '
|
28 |
foreach ( $qsm_post_types as $post_type ) {
|
29 |
$items = get_posts(
|
30 |
array(
|
24 |
|
25 |
// Taken from Easy Digital Downloads. Much better way of doing it than I was doing :)
|
26 |
// Cycle through custom post type array, retreive all posts, delete each one.
|
27 |
+
$qsm_post_types = array( 'qsm_quiz', 'qmn_log' );
|
28 |
foreach ( $qsm_post_types as $post_type ) {
|
29 |
$items = get_posts(
|
30 |
array(
|