Quiz And Survey Master (Formerly Quiz Master Next) - Version 1.6.1

Version Description

This update allows you to set the amount of tries a user has for cetain quizzes. Also fixes several bugs.

Download this release

Release Info

Developer fpcorso
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.5.1 to 1.6.1

includes/mlw_dashboard.php CHANGED
@@ -8,6 +8,7 @@ Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
8
 
9
  function mlw_generate_quiz_dashboard(){
10
 
 
11
  echo "
12
  <script>
13
  function mlw_validateForm()
@@ -41,8 +42,11 @@ function mlw_generate_quiz_dashboard(){
41
  }
42
  </script>
43
  ";
 
 
44
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
45
 
 
46
  ///Creates the widgets
47
  add_meta_box("wpss_mrts", 'Quiz Daily Stats - Times Taken', "mlw_dashboard_box", "quiz_wpss");
48
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
@@ -416,16 +420,25 @@ function mlw_dashboard_box_six()
416
  <div>
417
  <table width='100%'>
418
  <tr>
419
- <td align='left'>1.5.1 (February 26, 2014)</td>
 
 
 
 
 
 
 
 
 
420
  </tr>
421
  <tr>
422
- <td align='left'>* Added Ability To Load Only Set Amount Of Questions From Total Questions</td>
423
  </tr>
424
  <tr>
425
- <td align='left'>* Fixed PHP Notices Throughout Plugin</td>
426
  </tr>
427
  <tr>
428
- <td align='left'>* Fixed Hidden Pop-Up Bug</td>
429
  </tr>
430
  </table>
431
  </div>
@@ -538,14 +551,6 @@ function mlw_dashboard_box_eight()
538
  </tr>
539
  </table>
540
  <p>Thank you to those who have contributed so far!</p>
541
- <h3>Supporters</h3>
542
- <ul>
543
- <li>Tracy B</li>
544
- <li>Bobby L</li>
545
- <li>Kristal P</li>
546
- <li>Jürgen C</li>
547
- <li>Larry J</li>
548
- </ul>
549
  </div>
550
  <?php
551
  }
8
 
9
  function mlw_generate_quiz_dashboard(){
10
 
11
+ //Support Email Validation Script
12
  echo "
13
  <script>
14
  function mlw_validateForm()
42
  }
43
  </script>
44
  ";
45
+
46
+ //Page Variables
47
  $mlw_quiz_version = get_option('mlw_quiz_master_version');
48
 
49
+
50
  ///Creates the widgets
51
  add_meta_box("wpss_mrts", 'Quiz Daily Stats - Times Taken', "mlw_dashboard_box", "quiz_wpss");
52
  add_meta_box("wpss_mrts", 'Quiz Total Stats', "mlw_dashboard_box_three", "quiz_wpss3");
420
  <div>
421
  <table width='100%'>
422
  <tr>
423
+ <td align='left'>1.6.1 (March 2, 2014)</td>
424
+ </tr>
425
+ <tr>
426
+ <td align='left'>* Added Ability To Limit Amount User Tries Certain Quizzes</td>
427
+ </tr>
428
+ <tr>
429
+ <td align='left'>* Minor Design Changes To Admin Pages</td>
430
+ </tr>
431
+ <tr>
432
+ <td align='left'>* Fixed Internet Explorer Quiz Adding Bug</td>
433
  </tr>
434
  <tr>
435
+ <td align='left'>* Fixed Results Link On Quizzes Page Bug</td>
436
  </tr>
437
  <tr>
438
+ <td align='left'>* Fixed Points Number Check Bug</td>
439
  </tr>
440
  <tr>
441
+ <td align='left'>* Fixed Limited Question Grading Bug</td>
442
  </tr>
443
  </table>
444
  </div>
551
  </tr>
552
  </table>
553
  <p>Thank you to those who have contributed so far!</p>
 
 
 
 
 
 
 
 
554
  </div>
555
  <?php
556
  }
includes/mlw_help.php CHANGED
@@ -3,14 +3,14 @@
3
  This page shows the user how-to's for using the plugin
4
  */
5
  /*
6
- Copyright 2013, My Local Webstop (email : fpcorso@mylocalwebstop.com)
7
  */
8
 
9
  function mlw_generate_help_page()
10
  {
11
  ?>
12
  <!-- css -->
13
- <link type="text/css" href="<?php echo plugin_dir_path( __FILE__ ); ?>/includes/css/redmond/jquery-ui-1.10.4.custom.css" rel="stylesheet" />
14
  <!-- jquery scripts -->
15
  <?php
16
  wp_enqueue_script( 'jquery' );
3
  This page shows the user how-to's for using the plugin
4
  */
5
  /*
6
+ Copyright 2014, My Local Webstop (email : fpcorso@mylocalwebstop.com)
7
  */
8
 
9
  function mlw_generate_help_page()
10
  {
11
  ?>
12
  <!-- css -->
13
+ <link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
14
  <!-- jquery scripts -->
15
  <?php
16
  wp_enqueue_script( 'jquery' );
includes/mlw_quiz.php CHANGED
@@ -16,6 +16,7 @@ function mlw_quiz_shortcode($atts)
16
  $mlw_quiz_id = $quiz;
17
  $mlw_display = "";
18
  global $wpdb;
 
19
 
20
 
21
  //Load quiz
@@ -26,6 +27,12 @@ function mlw_quiz_shortcode($atts)
26
  $mlw_quiz_options = $mlw_eaches;
27
  break;
28
  }
 
 
 
 
 
 
29
 
30
 
31
  //Load questions
@@ -185,7 +192,7 @@ function mlw_quiz_shortcode($atts)
185
  }
186
 
187
  //Display Quiz
188
- if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "")
189
  {
190
  //Update the quiz views
191
  $mlw_views = $mlw_quiz_options->quiz_views;
@@ -413,8 +420,21 @@ function mlw_quiz_shortcode($atts)
413
  //Display Completion Screen
414
  else
415
  {
416
- if (empty($mlw_spam_email))
 
 
 
 
 
417
  {
 
 
 
 
 
 
 
 
418
  //Variables needed for scoring
419
  $mlw_points = 0;
420
  $mlw_correct = 0;
@@ -430,70 +450,73 @@ function mlw_quiz_shortcode($atts)
430
 
431
  //See which answers were correct and award points if necessary
432
  foreach($mlw_questions as $mlw_question) {
433
- $mlw_user_text;
434
- $mlw_correct_text;
435
- $mlw_total_questions += 1;
436
- $mlw_user_answer = $_POST["question".$mlw_question->question_id];
437
- if ($mlw_user_answer == $mlw_question->correct_answer)
438
- {
439
- $mlw_correct += 1;
440
- }
441
- if ($mlw_user_answer == 1)
442
- {
443
- $mlw_points += $mlw_question->answer_one_points;
444
- $mlw_user_text = $mlw_question->answer_one;
445
- }
446
- if ($mlw_user_answer == 2)
447
- {
448
- $mlw_points += $mlw_question->answer_two_points;
449
- $mlw_user_text = $mlw_question->answer_two;
450
- }
451
- if ($mlw_user_answer == 3)
452
- {
453
- $mlw_points += $mlw_question->answer_three_points;
454
- $mlw_user_text = $mlw_question->answer_three;
455
- }
456
- if ($mlw_user_answer == 4)
457
- {
458
- $mlw_points += $mlw_question->answer_four_points;
459
- $mlw_user_text = $mlw_question->answer_four;
460
- }
461
- if ($mlw_user_answer == 5)
462
- {
463
- $mlw_points += $mlw_question->answer_five_points;
464
- $mlw_user_text = $mlw_question->answer_five;
465
- }
466
- if ($mlw_user_answer == 6)
467
- {
468
- $mlw_points += $mlw_question->answer_six_points;
469
- $mlw_user_text = $mlw_question->answer_six;
470
- }
471
-
472
- if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
473
- if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
474
- if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
475
- if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
476
- if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
477
- if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
478
-
479
- if (isset($_POST["mlwComment".$mlw_question->question_id]))
480
- {
481
- $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
482
- }
483
- else
484
  {
485
- $mlw_qm_question_comment = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  }
487
-
488
- $mlw_question_answer_display = $mlw_quiz_options->question_answer_template;
489
- $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
490
- $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
491
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
492
- $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
493
- $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , $mlw_question->question_answer_info, $mlw_question_answer_display);
494
-
495
- $mlw_question_answers .= $mlw_question_answer_display;
496
- $mlw_question_answers .= "<br />";
497
  }
498
  $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
499
 
@@ -585,7 +608,11 @@ function mlw_quiz_shortcode($atts)
585
  }
586
  else
587
  {
588
- $mlw_display .= "Thank you.";
 
 
 
 
589
  }
590
  }
591
  return $mlw_display;
16
  $mlw_quiz_id = $quiz;
17
  $mlw_display = "";
18
  global $wpdb;
19
+ $mlw_qmn_isAllowed = true;
20
 
21
 
22
  //Load quiz
27
  $mlw_quiz_options = $mlw_eaches;
28
  break;
29
  }
30
+ if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() )
31
+ {
32
+ $current_user = wp_get_current_user();
33
+ $mlw_qmn_user_try_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE email='%s' AND deleted='0'", $current_user->user_email ) );
34
+ if ($mlw_qmn_user_try_count >= $mlw_quiz_options->total_user_tries) { $mlw_qmn_isAllowed = false; }
35
+ }
36
 
37
 
38
  //Load questions
192
  }
193
 
194
  //Display Quiz
195
+ if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "" && $mlw_qmn_isAllowed)
196
  {
197
  //Update the quiz views
198
  $mlw_views = $mlw_quiz_options->quiz_views;
420
  //Display Completion Screen
421
  else
422
  {
423
+ if (empty($mlw_spam_email) && $mlw_qmn_isAllowed)
424
+ {
425
+
426
+ //Load questions
427
+ $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_questions" . " WHERE quiz_id=".$mlw_quiz_id." AND deleted='0' ";
428
+ if ($mlw_quiz_options->randomness_order == 0)
429
  {
430
+ $sql .= "ORDER BY question_order ASC";
431
+ }
432
+ if ($mlw_quiz_options->randomness_order == 1)
433
+ {
434
+ $sql .= "ORDER BY rand()";
435
+ }
436
+ $mlw_questions = $wpdb->get_results($sql);
437
+
438
  //Variables needed for scoring
439
  $mlw_points = 0;
440
  $mlw_correct = 0;
450
 
451
  //See which answers were correct and award points if necessary
452
  foreach($mlw_questions as $mlw_question) {
453
+ if (isset($_POST["question".$mlw_question->question_id]))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  {
455
+ $mlw_user_text;
456
+ $mlw_correct_text;
457
+ $mlw_total_questions += 1;
458
+ $mlw_user_answer = $_POST["question".$mlw_question->question_id];
459
+ if ($mlw_user_answer == $mlw_question->correct_answer)
460
+ {
461
+ $mlw_correct += 1;
462
+ }
463
+ if ($mlw_user_answer == 1)
464
+ {
465
+ $mlw_points += $mlw_question->answer_one_points;
466
+ $mlw_user_text = $mlw_question->answer_one;
467
+ }
468
+ if ($mlw_user_answer == 2)
469
+ {
470
+ $mlw_points += $mlw_question->answer_two_points;
471
+ $mlw_user_text = $mlw_question->answer_two;
472
+ }
473
+ if ($mlw_user_answer == 3)
474
+ {
475
+ $mlw_points += $mlw_question->answer_three_points;
476
+ $mlw_user_text = $mlw_question->answer_three;
477
+ }
478
+ if ($mlw_user_answer == 4)
479
+ {
480
+ $mlw_points += $mlw_question->answer_four_points;
481
+ $mlw_user_text = $mlw_question->answer_four;
482
+ }
483
+ if ($mlw_user_answer == 5)
484
+ {
485
+ $mlw_points += $mlw_question->answer_five_points;
486
+ $mlw_user_text = $mlw_question->answer_five;
487
+ }
488
+ if ($mlw_user_answer == 6)
489
+ {
490
+ $mlw_points += $mlw_question->answer_six_points;
491
+ $mlw_user_text = $mlw_question->answer_six;
492
+ }
493
+
494
+ if ($mlw_question->correct_answer == 1) {$mlw_correct_text = $mlw_question->answer_one;}
495
+ if ($mlw_question->correct_answer == 2) {$mlw_correct_text = $mlw_question->answer_two;}
496
+ if ($mlw_question->correct_answer == 3) {$mlw_correct_text = $mlw_question->answer_three;}
497
+ if ($mlw_question->correct_answer == 4) {$mlw_correct_text = $mlw_question->answer_four;}
498
+ if ($mlw_question->correct_answer == 5) {$mlw_correct_text = $mlw_question->answer_five;}
499
+ if ($mlw_question->correct_answer == 6) {$mlw_correct_text = $mlw_question->answer_six;}
500
+
501
+ if (isset($_POST["mlwComment".$mlw_question->question_id]))
502
+ {
503
+ $mlw_qm_question_comment = $_POST["mlwComment".$mlw_question->question_id];
504
+ }
505
+ else
506
+ {
507
+ $mlw_qm_question_comment = "";
508
+ }
509
+
510
+ $mlw_question_answer_display = $mlw_quiz_options->question_answer_template;
511
+ $mlw_question_answer_display = str_replace( "%QUESTION%" , htmlspecialchars_decode($mlw_question->question_name, ENT_QUOTES), $mlw_question_answer_display);
512
+ $mlw_question_answer_display = str_replace( "%USER_ANSWER%" , $mlw_user_text, $mlw_question_answer_display);
513
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER%" , $mlw_correct_text, $mlw_question_answer_display);
514
+ $mlw_question_answer_display = str_replace( "%USER_COMMENTS%" , $mlw_qm_question_comment, $mlw_question_answer_display);
515
+ $mlw_question_answer_display = str_replace( "%CORRECT_ANSWER_INFO%" , $mlw_question->question_answer_info, $mlw_question_answer_display);
516
+
517
+ $mlw_question_answers .= $mlw_question_answer_display;
518
+ $mlw_question_answers .= "<br />";
519
  }
 
 
 
 
 
 
 
 
 
 
520
  }
521
  $mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
522
 
608
  }
609
  else
610
  {
611
+ if (!$mlw_qmn_isAllowed)
612
+ {
613
+ $mlw_display .= $mlw_quiz_options->total_user_tries_text;
614
+ }
615
+ else { $mlw_display .= "Thank you."; }
616
  }
617
  }
618
  return $mlw_display;
includes/mlw_quiz_admin.php CHANGED
@@ -30,8 +30,8 @@ function mlw_generate_quiz_admin()
30
  5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
31
  $mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
32
  $insert = "INSERT INTO " . $table_name .
33
- "(quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, quiz_views, quiz_taken, deleted) " .
34
- "VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 0, 0)";
35
  $results = $wpdb->query( $insert );
36
  if ($results != false)
37
  {
@@ -120,7 +120,7 @@ function mlw_generate_quiz_admin()
120
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
121
  $mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
122
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
123
- $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", 0, 0, 0)" );
124
  if ($results != false)
125
  {
126
  $hasDuplicatedQuiz = true;
@@ -390,45 +390,58 @@ function mlw_generate_quiz_admin()
390
  <th>Quiz Taken</th>
391
  </tr></thead>";
392
  $display .= "<tbody id=\"the-list\">{$quotes_list}</tbody>";
 
 
 
 
 
 
 
 
393
  $display .= "</table>";
394
  echo $display;
395
  ?>
396
 
397
  <button id="new_quiz_button">Create New Quiz</button>
398
- <div id="new_quiz_dialog" title="Create New Quiz" style="display:none;">
399
- <table class="wide" style="text-align: left; white-space: nowrap;">
400
- <thead>
401
-
402
- <tr valign="top">
403
- <th scope="row">&nbsp;</th>
404
- <td></td>
405
- </tr>
406
- <?php
407
- echo "<form action='' method='post'>";
408
- echo "<input type='hidden' name='create_quiz' value='confirmation' />";
409
- ?>
410
 
 
411
 
412
- <tr valign="top">
413
- <th scope="row"><h3>Create New Quiz</h3></th>
414
- <td></td>
415
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
 
417
- <tr valign="top">
418
- <th scope="row">Quiz Name</th>
419
- <td>
420
- <input type="text" name="quiz_name" value="" style="border-color:#000000;
421
- color:#3300CC;
422
- cursor:hand;"/>
423
- </td>
424
- </tr>
425
- </thead>
426
- </table>
427
- <?php
428
- echo "<p class='submit'><input type='submit' class='button-primary' value='Create Quiz' /></p>";
429
- echo "</form>";
430
- ?>
431
- </div>
432
  <div id="edit_dialog" title="Edit Quiz Name" style="display:none;">
433
  <h3>Quiz Name:</h3><br />
434
  <form action='' method='post'>
@@ -438,6 +451,8 @@ function mlw_generate_quiz_admin()
438
  <input type="submit" class="button-primary" value="Edit" />
439
  </form>
440
  </div>
 
 
441
  <div id="duplicate_dialog" title="Duplicate Quiz" style="display:none;">
442
  <h3>This will create a new quiz with the same settings as <span id="duplicate_quiz_name"></span>. </h3><br />
443
  <p>This does not currently duplicate the questions, only the options, templates, settings, etc...</p>
@@ -449,6 +464,8 @@ function mlw_generate_quiz_admin()
449
  <input type="submit" class="button-primary" value="Duplicate" />
450
  </form>
451
  </div>
 
 
452
  <div id="delete_dialog" title="Delete Quiz?" style="display:none;">
453
  <h3><b>Are you sure you want to delete Quiz <span id="delete_quiz_id"></span>?</b></h3>
454
  <?php
@@ -460,6 +477,8 @@ function mlw_generate_quiz_admin()
460
  echo "</form>";
461
  ?>
462
  </div>
 
 
463
  <div id="dialog" title="Help" style="display:none;">
464
  <h3><b>Help</b></h3>
465
  <p>This page shows all of the quizzes currently on your website.</p>
30
  5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
31
  $mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
32
  $insert = "INSERT INTO " . $table_name .
33
+ "(quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, quiz_views, quiz_taken, deleted) " .
34
+ "VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 'Enter Your Text Here', 0, 0, 0)";
35
  $results = $wpdb->query( $insert );
36
  if ($results != false)
37
  {
120
  $mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
121
  $mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
122
  $mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
123
+ $results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', 0, 0, 0)" );
124
  if ($results != false)
125
  {
126
  $hasDuplicatedQuiz = true;
390
  <th>Quiz Taken</th>
391
  </tr></thead>";
392
  $display .= "<tbody id=\"the-list\">{$quotes_list}</tbody>";
393
+ $display .= "<tfoot><tr>
394
+ <th>Quiz ID</th>
395
+ <th>Quiz Name</th>
396
+ <th>Quiz Shortcode</th>
397
+ <th>Leaderboard Shortcode</th>
398
+ <th>Quiz Views</th>
399
+ <th>Quiz Taken</th>
400
+ </tr></tfoot>";
401
  $display .= "</table>";
402
  echo $display;
403
  ?>
404
 
405
  <button id="new_quiz_button">Create New Quiz</button>
 
 
 
 
 
 
 
 
 
 
 
 
406
 
407
+ <!--Dialogs-->
408
 
409
+ <!--New Quiz Dialog-->
410
+ <div id="new_quiz_dialog" title="Create New Quiz" style="display:none;">
411
+ <?php
412
+ echo "<form action='' method='post'>";
413
+ echo "<input type='hidden' name='create_quiz' value='confirmation' />";
414
+ ?>
415
+ <table class="wide" style="text-align: left; white-space: nowrap;">
416
+ <thead>
417
+
418
+ <tr valign="top">
419
+ <th scope="row">&nbsp;</th>
420
+ <td></td>
421
+ </tr>
422
+
423
+ <tr valign="top">
424
+ <th scope="row"><h3>Create New Quiz</h3></th>
425
+ <td></td>
426
+ </tr>
427
+
428
+ <tr valign="top">
429
+ <th scope="row">Quiz Name</th>
430
+ <td>
431
+ <input type="text" name="quiz_name" value="" style="border-color:#000000;
432
+ color:#3300CC;
433
+ cursor:hand;"/>
434
+ </td>
435
+ </tr>
436
+ </thead>
437
+ </table>
438
+ <?php
439
+ echo "<p class='submit'><input type='submit' class='button-primary' value='Create Quiz' /></p>";
440
+ echo "</form>";
441
+ ?>
442
+ </div>
443
 
444
+ <!--Edit Quiz Name Dialog-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  <div id="edit_dialog" title="Edit Quiz Name" style="display:none;">
446
  <h3>Quiz Name:</h3><br />
447
  <form action='' method='post'>
451
  <input type="submit" class="button-primary" value="Edit" />
452
  </form>
453
  </div>
454
+
455
+ <!--Duplicate Quiz Dialog-->
456
  <div id="duplicate_dialog" title="Duplicate Quiz" style="display:none;">
457
  <h3>This will create a new quiz with the same settings as <span id="duplicate_quiz_name"></span>. </h3><br />
458
  <p>This does not currently duplicate the questions, only the options, templates, settings, etc...</p>
464
  <input type="submit" class="button-primary" value="Duplicate" />
465
  </form>
466
  </div>
467
+
468
+ <!--Delete Quiz Dialog-->
469
  <div id="delete_dialog" title="Delete Quiz?" style="display:none;">
470
  <h3><b>Are you sure you want to delete Quiz <span id="delete_quiz_id"></span>?</b></h3>
471
  <?php
477
  echo "</form>";
478
  ?>
479
  </div>
480
+
481
+ <!--Help Dialog-->
482
  <div id="dialog" title="Help" style="display:none;">
483
  <h3><b>Help</b></h3>
484
  <p>This page shows all of the quizzes currently on your website.</p>
includes/mlw_quiz_install.php CHANGED
@@ -73,6 +73,10 @@ function mlw_quiz_activate()
73
  comment_section INT NOT NULL,
74
 
75
  question_from_total INT NOT NULL,
 
 
 
 
76
 
77
  quiz_views INT NOT NULL,
78
 
73
  comment_section INT NOT NULL,
74
 
75
  question_from_total INT NOT NULL,
76
+
77
+ total_user_tries INT NOT NULL,
78
+
79
+ total_user_tries_text TEXT NOT NULL,
80
 
81
  quiz_views INT NOT NULL,
82
 
includes/mlw_quiz_options.php CHANGED
@@ -32,24 +32,25 @@ function mlw_generate_quiz_options()
32
  //Variables from edit question form
33
  $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
34
  $edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
35
- $edit_answer_one_points = $_POST["edit_answer_one_points"];
 
36
  $edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
37
- $edit_answer_two_points = $_POST["edit_answer_two_points"];
38
  $edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
39
- $edit_answer_three_points = $_POST["edit_answer_three_points"];
40
  $edit_answer_four = htmlspecialchars($_POST["edit_answer_four"], ENT_QUOTES);
41
- $edit_answer_four_points = $_POST["edit_answer_four_points"];
42
  $edit_answer_five = htmlspecialchars($_POST["edit_answer_five"], ENT_QUOTES);
43
- $edit_answer_five_points = $_POST["edit_answer_five_points"];
44
  $edit_answer_six = htmlspecialchars($_POST["edit_answer_six"], ENT_QUOTES);
45
- $edit_answer_six_points = $_POST["edit_answer_six_points"];
46
  $edit_correct_answer = $_POST["edit_correct_answer"];
47
  $edit_question_answer_info = $_POST["edit_correct_answer_info"];
48
- $mlw_edit_question_id = $_POST["edit_question_id"];
49
  $mlw_edit_question_type = $_POST["edit_question_type"];
50
  $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
51
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
52
- $edit_question_order = $_POST["edit_question_order"];
53
  $quiz_id = $_POST["quiz_id"];
54
 
55
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."', answer_one='".$edit_answer_one."', answer_one_points='".$edit_answer_one_points."', answer_two='".$edit_answer_two."', answer_two_points='".$edit_answer_two_points."', answer_three='".$edit_answer_three."', answer_three_points='".$edit_answer_three_points."', answer_four='".$edit_answer_four."', answer_four_points='".$edit_answer_four_points."', answer_five='".$edit_answer_five."', answer_five_points='".$edit_answer_five_points."', answer_six='".$edit_answer_six."', answer_six_points='".$edit_answer_six_points."', correct_answer='".$edit_correct_answer."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
@@ -78,7 +79,7 @@ function mlw_generate_quiz_options()
78
  if ( isset($_POST["delete_question"]) && $_POST["delete_question"] == "confirmation")
79
  {
80
  //Variables from delete question form
81
- $mlw_question_id = $_POST["question_id"];
82
  $quiz_id = $_POST["quiz_id"];
83
 
84
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
@@ -109,23 +110,23 @@ function mlw_generate_quiz_options()
109
  //Variables from new question form
110
  $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
111
  $answer_one = htmlspecialchars($_POST["answer_one"], ENT_QUOTES);
112
- $answer_one_points = $_POST["answer_one_points"];
113
  $answer_two = htmlspecialchars($_POST["answer_two"], ENT_QUOTES);
114
- $answer_two_points = $_POST["answer_two_points"];
115
  $answer_three = htmlspecialchars($_POST["answer_three"], ENT_QUOTES);
116
- $answer_three_points = $_POST["answer_three_points"];
117
  $answer_four = htmlspecialchars($_POST["answer_four"], ENT_QUOTES);
118
- $answer_four_points = $_POST["answer_four_points"];
119
  $answer_five = htmlspecialchars($_POST["answer_five"], ENT_QUOTES);
120
- $answer_five_points = $_POST["answer_five_points"];
121
  $answer_six = htmlspecialchars($_POST["answer_six"], ENT_QUOTES);
122
- $answer_six_points = $_POST["answer_six_points"];
123
  $correct_answer = $_POST["correct_answer"];
124
  $question_answer_info = $_POST["correct_answer_info"];
125
  $question_type = $_POST["question_type"];
126
  $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
127
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
128
- $new_question_order = $_POST["new_question_order"];
129
  $quiz_id = $_POST["quiz_id"];
130
  $table_name = $wpdb->prefix . "mlw_questions";
131
  $insert = "INSERT INTO " . $table_name .
@@ -185,6 +186,7 @@ function mlw_generate_quiz_options()
185
  //Variables for save templates form
186
  $mlw_before_message = $_POST["mlw_quiz_before_message"];
187
  $mlw_after_message = $_POST["mlw_quiz_after_message"];
 
188
  $mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
189
  $mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
190
  $mlw_submit_button_text = $_POST["mlw_submitText"];
@@ -198,7 +200,7 @@ function mlw_generate_quiz_options()
198
  $mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
199
  $quiz_id = $_POST["quiz_id"];
200
 
201
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', message_after='".$mlw_after_message."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."' WHERE quiz_id=".$quiz_id;
202
  $results = $wpdb->query( $update );
203
  if ($results != false)
204
  {
@@ -232,6 +234,7 @@ function mlw_generate_quiz_options()
232
  $mlw_system = $_POST["system"];
233
  $mlw_qmn_questions_from_total = $_POST["question_from_total"];
234
  $mlw_randomness_order = $_POST["randomness_order"];
 
235
  $mlw_send_user_email = $_POST["sendUserEmail"];
236
  $mlw_send_admin_email = $_POST["sendAdminEmail"];
237
  $mlw_contact_location = $_POST["contact_info_location"];
@@ -244,7 +247,7 @@ function mlw_generate_quiz_options()
244
  $mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
245
  $quiz_id = $_POST["quiz_id"];
246
 
247
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."', question_from_total=".$mlw_qmn_questions_from_total." WHERE quiz_id=".$quiz_id;
248
  $results = $wpdb->query( $update );
249
  if ($results != false)
250
  {
@@ -767,6 +770,10 @@ function mlw_generate_quiz_options()
767
  <th>Question Name</th>
768
  </tr></thead>";
769
  $display .= "<tbody id=\"the-list\">{$question_list}</tbody>";
 
 
 
 
770
  $display .= "</table>";
771
  echo $display;
772
  ?>
@@ -1197,6 +1204,16 @@ function mlw_generate_quiz_options()
1197
  <td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
1198
  </td>
1199
  </tr>
 
 
 
 
 
 
 
 
 
 
1200
  </table>
1201
 
1202
  </div>
@@ -1331,6 +1348,12 @@ function mlw_generate_quiz_options()
1331
  <input type="radio" id="radio24" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio24">Yes</label>
1332
  </div></td>
1333
  </tr>
 
 
 
 
 
 
1334
  <tr valign="top">
1335
  <th scope="row"><label for="contact_info_location">Would you like to ask for the contact information at the beginning or at the end of the quiz?</label></th>
1336
  <td><div id="contact_info_location">
32
  //Variables from edit question form
33
  $edit_question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["edit_question_name"], ENT_QUOTES))));
34
  $edit_answer_one = htmlspecialchars($_POST["edit_answer_one"], ENT_QUOTES);
35
+ $edit_answer_one_points = intval($_POST["edit_answer_one_points"]);
36
+ echo $edit_answer_one_points;
37
  $edit_answer_two = htmlspecialchars($_POST["edit_answer_two"], ENT_QUOTES);
38
+ $edit_answer_two_points = intval($_POST["edit_answer_two_points"]);
39
  $edit_answer_three = htmlspecialchars($_POST["edit_answer_three"], ENT_QUOTES);
40
+ $edit_answer_three_points = intval($_POST["edit_answer_three_points"]);
41
  $edit_answer_four = htmlspecialchars($_POST["edit_answer_four"], ENT_QUOTES);
42
+ $edit_answer_four_points = intval($_POST["edit_answer_four_points"]);
43
  $edit_answer_five = htmlspecialchars($_POST["edit_answer_five"], ENT_QUOTES);
44
+ $edit_answer_five_points = intval($_POST["edit_answer_five_points"]);
45
  $edit_answer_six = htmlspecialchars($_POST["edit_answer_six"], ENT_QUOTES);
46
+ $edit_answer_six_points = intval($_POST["edit_answer_six_points"]);
47
  $edit_correct_answer = $_POST["edit_correct_answer"];
48
  $edit_question_answer_info = $_POST["edit_correct_answer_info"];
49
+ $mlw_edit_question_id = intval($_POST["edit_question_id"]);
50
  $mlw_edit_question_type = $_POST["edit_question_type"];
51
  $edit_comments = htmlspecialchars($_POST["edit_comments"], ENT_QUOTES);
52
  $edit_hint = htmlspecialchars($_POST["edit_hint"], ENT_QUOTES);
53
+ $edit_question_order = intval($_POST["edit_question_order"]);
54
  $quiz_id = $_POST["quiz_id"];
55
 
56
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET question_name='".$edit_question_name."', answer_one='".$edit_answer_one."', answer_one_points='".$edit_answer_one_points."', answer_two='".$edit_answer_two."', answer_two_points='".$edit_answer_two_points."', answer_three='".$edit_answer_three."', answer_three_points='".$edit_answer_three_points."', answer_four='".$edit_answer_four."', answer_four_points='".$edit_answer_four_points."', answer_five='".$edit_answer_five."', answer_five_points='".$edit_answer_five_points."', answer_six='".$edit_answer_six."', answer_six_points='".$edit_answer_six_points."', correct_answer='".$edit_correct_answer."', question_answer_info='".$edit_question_answer_info."', comments='".$edit_comments."', hints='".$edit_hint."', question_order='".$edit_question_order."', question_type='".$mlw_edit_question_type."' WHERE question_id=".$mlw_edit_question_id;
79
  if ( isset($_POST["delete_question"]) && $_POST["delete_question"] == "confirmation")
80
  {
81
  //Variables from delete question form
82
+ $mlw_question_id = intval($_POST["question_id"]);
83
  $quiz_id = $_POST["quiz_id"];
84
 
85
  $update = "UPDATE " . $wpdb->prefix . "mlw_questions" . " SET deleted=1 WHERE question_id=".$mlw_question_id;
110
  //Variables from new question form
111
  $question_name = trim(preg_replace('/\s+/',' ', nl2br(htmlspecialchars($_POST["question_name"], ENT_QUOTES))));
112
  $answer_one = htmlspecialchars($_POST["answer_one"], ENT_QUOTES);
113
+ $answer_one_points = intval($_POST["answer_one_points"]);
114
  $answer_two = htmlspecialchars($_POST["answer_two"], ENT_QUOTES);
115
+ $answer_two_points = intval($_POST["answer_two_points"]);
116
  $answer_three = htmlspecialchars($_POST["answer_three"], ENT_QUOTES);
117
+ $answer_three_points = intval($_POST["answer_three_points"]);
118
  $answer_four = htmlspecialchars($_POST["answer_four"], ENT_QUOTES);
119
+ $answer_four_points = intval($_POST["answer_four_points"]);
120
  $answer_five = htmlspecialchars($_POST["answer_five"], ENT_QUOTES);
121
+ $answer_five_points = intval($_POST["answer_five_points"]);
122
  $answer_six = htmlspecialchars($_POST["answer_six"], ENT_QUOTES);
123
+ $answer_six_points = intval($_POST["answer_six_points"]);
124
  $correct_answer = $_POST["correct_answer"];
125
  $question_answer_info = $_POST["correct_answer_info"];
126
  $question_type = $_POST["question_type"];
127
  $comments = htmlspecialchars($_POST["comments"], ENT_QUOTES);
128
  $hint = htmlspecialchars($_POST["hint"], ENT_QUOTES);
129
+ $new_question_order = intval($_POST["new_question_order"]);
130
  $quiz_id = $_POST["quiz_id"];
131
  $table_name = $wpdb->prefix . "mlw_questions";
132
  $insert = "INSERT INTO " . $table_name .
186
  //Variables for save templates form
187
  $mlw_before_message = $_POST["mlw_quiz_before_message"];
188
  $mlw_after_message = $_POST["mlw_quiz_after_message"];
189
+ $mlw_user_tries_text = $_POST["mlw_quiz_total_user_tries_text"];
190
  $mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
191
  $mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
192
  $mlw_submit_button_text = $_POST["mlw_submitText"];
200
  $mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
201
  $quiz_id = $_POST["quiz_id"];
202
 
203
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', message_after='".$mlw_after_message."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."', total_user_tries_text='".$mlw_user_tries_text."' WHERE quiz_id=".$quiz_id;
204
  $results = $wpdb->query( $update );
205
  if ($results != false)
206
  {
234
  $mlw_system = $_POST["system"];
235
  $mlw_qmn_questions_from_total = $_POST["question_from_total"];
236
  $mlw_randomness_order = $_POST["randomness_order"];
237
+ $mlw_total_user_tries = intval($_POST["total_user_tries"]);
238
  $mlw_send_user_email = $_POST["sendUserEmail"];
239
  $mlw_send_admin_email = $_POST["sendAdminEmail"];
240
  $mlw_contact_location = $_POST["contact_info_location"];
247
  $mlw_qmn_loggedin_contact = $_POST["loggedin_user_contact"];
248
  $quiz_id = $_POST["quiz_id"];
249
 
250
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', loggedin_user_contact='".$mlw_qmn_loggedin_contact."', contact_info_location=".$mlw_contact_location.", user_name='".$mlw_user_name."', user_comp='".$mlw_user_comp."', user_email='".$mlw_user_email."', user_phone='".$mlw_user_phone."', admin_email='".$mlw_admin_email."', comment_section='".$mlw_comment_section."', randomness_order='".$mlw_randomness_order."', question_from_total=".$mlw_qmn_questions_from_total.", total_user_tries=".$mlw_total_user_tries." WHERE quiz_id=".$quiz_id;
251
  $results = $wpdb->query( $update );
252
  if ($results != false)
253
  {
770
  <th>Question Name</th>
771
  </tr></thead>";
772
  $display .= "<tbody id=\"the-list\">{$question_list}</tbody>";
773
+ $display .= "<tfoot><tr>
774
+ <th>Question Order</th>
775
+ <th>Question Name</th>
776
+ </tr></tfoot>";
777
  $display .= "</table>";
778
  echo $display;
779
  ?>
1204
  <td><textarea cols="80" rows="15" id="mlw_quiz_after_message" name="mlw_quiz_after_message"><?php echo $mlw_quiz_options->message_after; ?></textarea>
1205
  </td>
1206
  </tr>
1207
+ <tr>
1208
+ <td width="30%">
1209
+ <strong>Message Displayed If User Has Tried Quiz Too Many Times</strong>
1210
+ <br />
1211
+ <p>Allowed Variables: </p>
1212
+ <p style="margin: 2px 0">- %QUIZ_NAME%</p>
1213
+ </td>
1214
+ <td><textarea cols="80" rows="15" id="mlw_quiz_total_user_tries_text" name="mlw_quiz_total_user_tries_text"><?php echo $mlw_quiz_options->total_user_tries_text; ?></textarea>
1215
+ </td>
1216
+ </tr>
1217
  </table>
1218
 
1219
  </div>
1348
  <input type="radio" id="radio24" name="randomness_order" <?php if ($mlw_quiz_options->randomness_order == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio24">Yes</label>
1349
  </div></td>
1350
  </tr>
1351
+ <tr valign="top">
1352
+ <th scope="row"><label for="total_user_tries">How many times can a user take this quiz? (Leave 0 for as many times as the user wants to. Currently only works for registered users)</label></th>
1353
+ <td>
1354
+ <input name="total_user_tries" type="number" step="1" min="0" id="total_user_tries" value="<?php echo $mlw_quiz_options->total_user_tries; ?>" class="regular-text" />
1355
+ </td>
1356
+ </tr>
1357
  <tr valign="top">
1358
  <th scope="row"><label for="contact_info_location">Would you like to ask for the contact information at the beginning or at the end of the quiz?</label></th>
1359
  <td><div id="contact_info_location">
includes/mlw_results.php CHANGED
@@ -37,7 +37,7 @@ function mlw_generate_quiz_results()
37
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE deleted='0'";
38
  if (isset($_GET["quiz_id"]) && $_GET["quiz_id"] != "")
39
  {
40
- $sql .= " AND quiz_id=".$quiz_id;
41
  }
42
  $sql .= " ORDER BY result_id DESC";
43
 
37
  $sql = "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE deleted='0'";
38
  if (isset($_GET["quiz_id"]) && $_GET["quiz_id"] != "")
39
  {
40
+ $sql .= " AND quiz_id=".intval($_GET["quiz_id"]);
41
  }
42
  $sql .= " ORDER BY result_id DESC";
43
 
includes/mlw_tools.php CHANGED
@@ -121,23 +121,23 @@ function mlw_tools_box()
121
  if( $mlw_qmn_audit_page > 0 )
122
  {
123
  $mlw_qmn_previous_page = $mlw_qmn_audit_page - 2;
124
- $display .= "<a id=\"prev_page\" href=\"$_PHP_SELF?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_previous_page\">Previous 25 Audits</a>";
125
  if( $mlw_qmn_audit_left > $mlw_qmn_table_limit )
126
  {
127
- $display .= "<a id=\"next_page\" href=\"$_PHP_SELF?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_audit_page\">Next 25 Audits</a>";
128
  }
129
  }
130
  else if( $mlw_qmn_audit_page == 0 )
131
  {
132
  if( $mlw_qmn_audit_left > $mlw_qmn_table_limit )
133
  {
134
- $display .= "<a id=\"next_page\" href=\"$_PHP_SELF?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_audit_page\">Next 25 Audits</a>";
135
  }
136
  }
137
  else if( $mlw_qmn_audit_left < $mlw_qmn_table_limit )
138
  {
139
  $mlw_qmn_previous_page = $mlw_qmn_audit_page - 2;
140
- $display .= "<a id=\"prev_page\" href=\"$_PHP_SELF?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_previous_page\">Previous 25 Audits</a>";
141
  }
142
  $display .= "<table class=\"widefat\">";
143
  $display .= "<thead><tr>
121
  if( $mlw_qmn_audit_page > 0 )
122
  {
123
  $mlw_qmn_previous_page = $mlw_qmn_audit_page - 2;
124
+ $display .= "<a id=\"prev_page\" href=\"?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_previous_page\">Previous 25 Audits</a>";
125
  if( $mlw_qmn_audit_left > $mlw_qmn_table_limit )
126
  {
127
+ $display .= "<a id=\"next_page\" href=\"?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_audit_page\">Next 25 Audits</a>";
128
  }
129
  }
130
  else if( $mlw_qmn_audit_page == 0 )
131
  {
132
  if( $mlw_qmn_audit_left > $mlw_qmn_table_limit )
133
  {
134
+ $display .= "<a id=\"next_page\" href=\"?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_audit_page\">Next 25 Audits</a>";
135
  }
136
  }
137
  else if( $mlw_qmn_audit_left < $mlw_qmn_table_limit )
138
  {
139
  $mlw_qmn_previous_page = $mlw_qmn_audit_page - 2;
140
+ $display .= "<a id=\"prev_page\" href=\"?page=mlw_quiz_tools&&mlw_audit_page=$mlw_qmn_previous_page\">Previous 25 Audits</a>";
141
  }
142
  $display .= "<table class=\"widefat\">";
143
  $display .= "<thead><tr>
includes/mlw_update.php CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
- $data = "1.5.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
@@ -98,6 +98,22 @@ function mlw_quiz_update()
98
  $results = $wpdb->query( $update_sql );
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  global $wpdb;
102
  $table_name = $wpdb->prefix . "mlw_questions";
103
  //Update 0.5
6
  {
7
 
8
  //Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
9
+ $data = "1.6.1";
10
  if ( ! get_option('mlw_quiz_master_version'))
11
  {
12
  add_option('mlw_quiz_master_version' , $data);
98
  $results = $wpdb->query( $update_sql );
99
  }
100
 
101
+ //Update 1.6.1
102
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries'") != "total_user_tries")
103
+ {
104
+ $sql = "ALTER TABLE ".$table_name." ADD total_user_tries INT NOT NULL AFTER question_from_total";
105
+ $results = $wpdb->query( $sql );
106
+ $update_sql = "UPDATE ".$table_name." SET total_user_tries=0";
107
+ $results = $wpdb->query( $update_sql );
108
+ }
109
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'total_user_tries_text'") != "total_user_tries_text")
110
+ {
111
+ $sql = "ALTER TABLE ".$table_name." ADD total_user_tries_text TEXT NOT NULL AFTER total_user_tries";
112
+ $results = $wpdb->query( $sql );
113
+ $update_sql = "UPDATE ".$table_name." SET total_user_tries_text='Enter Your Text Here'";
114
+ $results = $wpdb->query( $update_sql );
115
+ }
116
+
117
  global $wpdb;
118
  $table_name = $wpdb->prefix . "mlw_questions";
119
  //Update 0.5
mlw_quizmaster2.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
- Version: 1.5.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
@@ -57,13 +57,13 @@ function mlw_add_menu()
57
  {
58
  if (function_exists('add_menu_page'))
59
  {
60
- add_menu_page('Quiz Master Next', 'Quiz Dashboard', 'manage_options', __FILE__, 'mlw_generate_quiz_dashboard', 'dashicons-feedback');
61
- add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 'manage_options', 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
62
- add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 'manage_options', 'mlw_quiz_options', 'mlw_generate_quiz_options');
63
- add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'manage_options', 'mlw_quiz_results', 'mlw_generate_quiz_results');
64
- add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'manage_options', 'mlw_quiz_result_details', 'mlw_generate_result_details');
65
  add_submenu_page(__FILE__, 'Tools', 'Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
66
- add_submenu_page(__FILE__, 'How-To', 'How-To', 'manage_options', 'mlw_how_to', 'mlw_generate_help_page');
67
  }
68
  }
69
  /*
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 1.6.1
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
57
  {
58
  if (function_exists('add_menu_page'))
59
  {
60
+ add_menu_page('Quiz Master Next', 'Quiz Dashboard', 'moderate_comments', __FILE__, 'mlw_generate_quiz_dashboard', 'dashicons-feedback');
61
+ add_submenu_page(__FILE__, 'Quizzes', 'Quizzes', 'moderate_comments', 'mlw_quiz_admin', 'mlw_generate_quiz_admin');
62
+ add_submenu_page(__FILE__, 'Quiz Options', 'Quiz Options', 'moderate_comments', 'mlw_quiz_options', 'mlw_generate_quiz_options');
63
+ add_submenu_page(__FILE__, 'Quiz Results', 'Quiz Results', 'moderate_comments', 'mlw_quiz_results', 'mlw_generate_quiz_results');
64
+ add_submenu_page(__FILE__, 'Quiz Result Details', 'Quiz Result Details', 'moderate_comments', 'mlw_quiz_result_details', 'mlw_generate_result_details');
65
  add_submenu_page(__FILE__, 'Tools', 'Tools', 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools');
66
+ add_submenu_page(__FILE__, 'How-To', 'How-To', 'moderate_comments', 'mlw_how_to', 'mlw_generate_help_page');
67
  }
68
  }
69
  /*
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
3
  Tags: quiz, test, score, survey, contact, form, email
4
  Requires at least: 3.3
5
  Tested up to: 3.8.1
6
- Stable tag: 1.5.1
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
@@ -22,6 +22,7 @@ Use this plugin to add multiple quizzes, tests, and surveys to your website. Thi
22
  * Can email user after taking the quiz
23
  * Can email an admin after a user takes the quiz
24
  * Can score the quiz using an incorrect/correct system, a points based system, or a not-graded system
 
25
  * Can enable comment boxes for each question and/or comment section at the end of the quiz
26
  * Can enable hints for questions
27
  * Can show user why the answer is the correct answer
@@ -37,6 +38,8 @@ Use this plugin to add multiple quizzes, tests, and surveys to your website. Thi
37
  * Questions can be in predetermined order or random
38
  * Leaderboards for every quiz which can be used as shortcode or in included widget
39
 
 
 
40
 
41
  == Installation ==
42
 
@@ -64,6 +67,12 @@ On each page, there is a "?" next to the page title. Clicking on it will bring u
64
  = How do you use that feature? =
65
  There is a How-To page that has many useful how-to's to assist you on using the plugin. If you still have any trouble, feel free to use the widget on the quiz dashboard within the plugin to contact me and I will help you.
66
 
 
 
 
 
 
 
67
  = I have an idea, how do I contact you? =
68
  Feel free to use the widget on the quiz dashboard within the plugin or from the contact page at mylocalwebstop.com.
69
 
@@ -79,6 +88,14 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
 
 
 
82
  = 1.5.1 (February 26, 2014) =
83
  * Added Ability To Load Only Set Amount Of Questions From Total Questions
84
  * Fixed PHP Notices On Quizzes Page
@@ -294,6 +311,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
294
 
295
  == Upgrade Notice ==
296
 
 
 
 
297
  = 1.5.1 =
298
  This update allows you to have the quiz only load a set number of questions from your total question bank. Also fixes several minor bugs.
299
 
3
  Tags: quiz, test, score, survey, contact, form, email
4
  Requires at least: 3.3
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.6.1
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
9
  Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
22
  * Can email user after taking the quiz
23
  * Can email an admin after a user takes the quiz
24
  * Can score the quiz using an incorrect/correct system, a points based system, or a not-graded system
25
+ * Can set amount of tries a user has to take the quiz
26
  * Can enable comment boxes for each question and/or comment section at the end of the quiz
27
  * Can enable hints for questions
28
  * Can show user why the answer is the correct answer
38
  * Questions can be in predetermined order or random
39
  * Leaderboards for every quiz which can be used as shortcode or in included widget
40
 
41
+ Be sure to check out all of our plugins in our Master Suite. Visit our plugins page for details: (http://mylocalwebstop.com/wordpress-plugins/)
42
+
43
 
44
  == Installation ==
45
 
67
  = How do you use that feature? =
68
  There is a How-To page that has many useful how-to's to assist you on using the plugin. If you still have any trouble, feel free to use the widget on the quiz dashboard within the plugin to contact me and I will help you.
69
 
70
+ = I need a lot of help setting up my quiz, what can you do to help? =
71
+ We now offer a monthly premium support plan that offers priority response, access to a premium support-only forum, and includes 1-on-1 training! For details, visit our services page: (http://mylocalwebstop.com/services/)
72
+
73
+ = Do you offer any 1-on-1 training to assist me in using this plugin? =
74
+ We now offer an installation service that includes 1-on-1 training as well as a monthly support plan that includes 1-on-1 training. For details, visit our services page: (http://mylocalwebstop.com/services/)
75
+
76
  = I have an idea, how do I contact you? =
77
  Feel free to use the widget on the quiz dashboard within the plugin or from the contact page at mylocalwebstop.com.
78
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.6.1 (March 2, 2014) =
92
+ * Added Ability To Limit Amount User Tries Certain Quizzes
93
+ * Fixed Internet Explorer Quiz Adding Bug
94
+ * Fixed Results Link On Quizzes Page Bug
95
+ * Fixed Points Number Check Bug
96
+ * Fixed Limited Question Grading Bug
97
+ * Minor Design Changes To Admin Pages
98
+
99
  = 1.5.1 (February 26, 2014) =
100
  * Added Ability To Load Only Set Amount Of Questions From Total Questions
101
  * Fixed PHP Notices On Quizzes Page
311
 
312
  == Upgrade Notice ==
313
 
314
+ = 1.6.1 =
315
+ This update allows you to set the amount of tries a user has for cetain quizzes. Also fixes several bugs.
316
+
317
  = 1.5.1 =
318
  This update allows you to have the quiz only load a set number of questions from your total question bank. Also fixes several minor bugs.
319