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

Version Description

Upgrade to be able to choose whether contact information is asked for at beginning or end of the quiz. Also, added ability to edit question order when adding new questions. Several minor design changes on admin side. Fixed double quote bug.

Download this release

Release Info

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

Code changes from version 0.9.5 to 0.9.6

includes/mlw_dashboard.php CHANGED
@@ -203,7 +203,7 @@ function mlw_dashboard_box_three()
203
  break;
204
  }
205
 
206
- $sql = "SELECT AVG(quiz_views) AS AvgViews FROM " . $wpdb->prefix . "mlw_quizzes";
207
  $mlw_average_views = $wpdb->get_results($sql);
208
 
209
  foreach($mlw_average_views as $mlw_eaches) {
@@ -211,7 +211,7 @@ function mlw_dashboard_box_three()
211
  break;
212
  }
213
 
214
- $sql = "SELECT AVG(quiz_taken) AS AvgTaken FROM " . $wpdb->prefix . "mlw_quizzes";
215
  $mlw_average_taken = $wpdb->get_results($sql);
216
 
217
  foreach($mlw_average_taken as $mlw_eaches) {
@@ -246,11 +246,11 @@ function mlw_dashboard_box_three()
246
  <td align='right'><?php echo $mlw_quiz_taken; ?></td>
247
  </tr>
248
  <tr>
249
- <td align='left'>Average Views Per Quiz</td>
250
  <td align='right'><?php echo $mlw_average_views; ?></td>
251
  </tr>
252
  <tr>
253
- <td align='left'>Average Times Taken Per Quiz</td>
254
  <td align='right'><?php echo $mlw_average_taken; ?></td>
255
  </tr>
256
  <tr>
@@ -330,9 +330,25 @@ function mlw_dashboard_box_five()
330
  $mlw_quiz_taken_two_month = $wpdb->get_results($sql);
331
  $mlw_quiz_taken_two_month = $wpdb->num_rows;
332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  ?>
334
  <div>
335
- <span class="inlinesparkline"><?php echo $mlw_quiz_taken_two_month.",".$mlw_quiz_taken_last_month.",".$mlw_quiz_taken_this_month; ?></span>
336
  </div>
337
  <?php
338
  }
203
  break;
204
  }
205
 
206
+ $sql = "SELECT ROUND(AVG(quiz_views), 0) AS AvgViews FROM " . $wpdb->prefix . "mlw_quizzes";
207
  $mlw_average_views = $wpdb->get_results($sql);
208
 
209
  foreach($mlw_average_views as $mlw_eaches) {
211
  break;
212
  }
213
 
214
+ $sql = "SELECT ROUND(AVG(quiz_taken), 0) AS AvgTaken FROM " . $wpdb->prefix . "mlw_quizzes";
215
  $mlw_average_taken = $wpdb->get_results($sql);
216
 
217
  foreach($mlw_average_taken as $mlw_eaches) {
246
  <td align='right'><?php echo $mlw_quiz_taken; ?></td>
247
  </tr>
248
  <tr>
249
+ <td align='left'>Average Amount Each Quiz Has Been Viewed</td>
250
  <td align='right'><?php echo $mlw_average_views; ?></td>
251
  </tr>
252
  <tr>
253
+ <td align='left'>Average Amount Each Quiz Has Been Taken</td>
254
  <td align='right'><?php echo $mlw_average_taken; ?></td>
255
  </tr>
256
  <tr>
330
  $mlw_quiz_taken_two_month = $wpdb->get_results($sql);
331
  $mlw_quiz_taken_two_month = $wpdb->num_rows;
332
 
333
+ $mlw_three_month_first = mktime(0, 0, 0, date("m") , date("d")-90, date("Y"));
334
+ $mlw_three_month_first = date("Y-m-d", $mlw_three_month_first);
335
+ $mlw_three_month_last = mktime(0, 0, 0, date("m") , date("d")-61, date("Y"));
336
+ $mlw_three_month_last = date("Y-m-d", $mlw_three_month_last);
337
+ $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_month_first." 00:00:00' AND '".$mlw_three_month_last." 23:59:59')";
338
+ $mlw_quiz_taken_three_month = $wpdb->get_results($sql);
339
+ $mlw_quiz_taken_three_month = $wpdb->num_rows;
340
+
341
+ $mlw_four_month_first = mktime(0, 0, 0, date("m") , date("d")-120, date("Y"));
342
+ $mlw_four_month_first = date("Y-m-d", $mlw_four_month_first);
343
+ $mlw_four_month_last = mktime(0, 0, 0, date("m") , date("d")-91, date("Y"));
344
+ $mlw_four_month_last = date("Y-m-d", $mlw_four_month_last);
345
+ $sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_month_first." 00:00:00' AND '".$mlw_four_month_last." 23:59:59')";
346
+ $mlw_quiz_taken_four_month = $wpdb->get_results($sql);
347
+ $mlw_quiz_taken_four_month = $wpdb->num_rows;
348
+
349
  ?>
350
  <div>
351
+ <span class="inlinesparkline"><?php echo $mlw_quiz_taken_four_month.",".$mlw_quiz_taken_three_month.",".$mlw_quiz_taken_two_month.",".$mlw_quiz_taken_last_month.",".$mlw_quiz_taken_this_month; ?></span>
352
  </div>
353
  <?php
354
  }
includes/mlw_main_page.php CHANGED
@@ -159,16 +159,28 @@ function quiz_wpss_mrt_meta_box2()
159
  <div>
160
  <table width='100%'>
161
  <tr>
162
- <td align='left'>0.9.5 (January 19, 2014)</td>
163
  </tr>
164
  <tr>
165
- <td align='left'>* Added Ability To Edit %QUESTIONS_ANSWERS% Template</td>
166
  </tr>
167
  <tr>
168
- <td align='left'>* Changed Name Of Support Page To Help Page</td>
169
  </tr>
170
  <tr>
171
- <td align='left'>* Minor Design Changes On Quiz Options Page</td>
 
 
 
 
 
 
 
 
 
 
 
 
172
  </tr>
173
  </table>
174
  </div>
@@ -185,9 +197,12 @@ function quiz_wpss_mrt_meta_box3()
185
  $user_name = $_POST["username"];
186
  $user_email = $_POST["email"];
187
  $user_message = $_POST["message"];
188
- if ($quiz_master_email_success == 'update' and $user_email != "" and $user_message != "")
 
 
189
  {
190
- wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master Next Plugin','Message from ' . $user_name . ' at ' . $user_email . " It says: " . "\n" . $user_message . "\n" . "Version ".$mlw_quiz_version);
 
191
  $quiz_master_email_message = "**Message Sent**";
192
  }
193
  }
@@ -195,7 +210,7 @@ function quiz_wpss_mrt_meta_box3()
195
  <div class='quiz_email_support'>
196
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=mlw_quiz_support" method='post' name='emailForm' onsubmit='return mlw_validateForm()'>
197
  <input type='hidden' name='action' value='update' />
198
- <table width='100%'>
199
  <tr>
200
  <td>If there is something you would like to suggest to add or even if you just want
201
  to let me know if you like the plugin or not, feel free to use the email form below.</td>
@@ -204,16 +219,28 @@ function quiz_wpss_mrt_meta_box3()
204
  <td><span name='mlw_support_message' id='mlw_support_message' style="color: red;"><?php echo $quiz_master_email_message; ?></span></td>
205
  </tr>
206
  <tr>
207
- <td align='left'><p>Name: <input type='text' name='username' value='' /></p></td>
 
 
 
 
 
 
 
 
 
 
 
 
208
  </tr>
209
  <tr>
210
- <td align='left'><p>Email: <input type='text' name='email' value='' /></p></td>
211
  </tr>
212
  <tr>
213
- <td align='left'><p>Message: </p></td>
214
  </tr>
215
  <tr>
216
- <td align='left'><p><TEXTAREA NAME="message" COLS=40 ROWS=6></TEXTAREA></p></td>
217
  </tr>
218
  <tr>
219
  <td align='left'><input type='submit' value='Send Email' /></td>
159
  <div>
160
  <table width='100%'>
161
  <tr>
162
+ <td align='left'>0.9.6 (January 21, 2014)</td>
163
  </tr>
164
  <tr>
165
+ <td align='left'>* Added Ability To Edit Question Order When Adding Questions</td>
166
  </tr>
167
  <tr>
168
+ <td align='left'>* Added Ability To Choose Whether Contact Info Is Asked For At Beginning Or End Of Quiz</td>
169
  </tr>
170
  <tr>
171
+ <td align='left'>* Defaulted Question Comment Field To None On New Questions</td>
172
+ </tr>
173
+ <tr>
174
+ <td align='left'>* Fixed Double Quote Bug</td>
175
+ </tr>
176
+ <tr>
177
+ <td align='left'>* Enhanced Monthly Stat Widget</td>
178
+ </tr>
179
+ <tr>
180
+ <td align='left'>* Minor Design Change To Quiz Total Stats Widget</td>
181
+ </tr>
182
+ <tr>
183
+ <td align='left'>* Minor Design Changes To Quiz Options Page</td>
184
  </tr>
185
  </table>
186
  </div>
197
  $user_name = $_POST["username"];
198
  $user_email = $_POST["email"];
199
  $user_message = $_POST["message"];
200
+ $user_quiz_url = $_POST["quiz_url"];
201
+ $current_user = wp_get_current_user();
202
+ if ($quiz_master_email_success == 'update')
203
  {
204
+ $mlw_message = "Message from ".$user_name." at ".$user_email." It says: \n \n ".$user_message."\n Version: ".$mlw_quiz_version."\n Quiz URL Provided: ".$user_quiz_url."\n User ".$current_user->display_name." from ".$current_user->user_email;
205
+ wp_mail('fpcorso@mylocalwebstop.com' ,'Support From Quiz Master Next Plugin', $mlw_message);
206
  $quiz_master_email_message = "**Message Sent**";
207
  }
208
  }
210
  <div class='quiz_email_support'>
211
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=mlw_quiz_support" method='post' name='emailForm' onsubmit='return mlw_validateForm()'>
212
  <input type='hidden' name='action' value='update' />
213
+ <table>
214
  <tr>
215
  <td>If there is something you would like to suggest to add or even if you just want
216
  to let me know if you like the plugin or not, feel free to use the email form below.</td>
219
  <td><span name='mlw_support_message' id='mlw_support_message' style="color: red;"><?php echo $quiz_master_email_message; ?></span></td>
220
  </tr>
221
  <tr>
222
+ <td align='left'><span style='font-weight:bold;';>Name (Required): </span></td>
223
+ </tr>
224
+ <tr>
225
+ <td><input type='text' name='username' value='' /></td>
226
+ </tr>
227
+ <tr>
228
+ <td align='left'><span style='font-weight:bold;';>Email (Required): </span></td>
229
+ </tr>
230
+ <tr>
231
+ <td><input type='text' name='email' value='' /></td>
232
+ </tr>
233
+ <tr>
234
+ <td align='left'><span style='font-weight:bold;';>URL To Quiz (Not Required): </span></td>
235
  </tr>
236
  <tr>
237
+ <td><input type='text' name='quiz_url' value='' /></td>
238
  </tr>
239
  <tr>
240
+ <td align='left'><span style='font-weight:bold;';>Message (Required): </span></td>
241
  </tr>
242
  <tr>
243
+ <td align='left'><TEXTAREA NAME="message" COLS=40 ROWS=6></TEXTAREA></td>
244
  </tr>
245
  <tr>
246
  <td align='left'><input type='submit' value='Send Email' /></td>
includes/mlw_quiz.php CHANGED
@@ -48,6 +48,78 @@ function mlw_quiz_shortcode($atts)
48
  $mlw_user_email = $_POST["mlwUserEmail"];
49
  $mlw_user_phone = $_POST["mlwUserPhone"];
50
  $mlw_spam_email = $_POST["email"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  /*
53
  The following code is for displaying the quiz and completion screen
@@ -148,71 +220,9 @@ function mlw_quiz_shortcode($atts)
148
  $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
149
  $mlw_display .= "<form name='quizForm' action='" . $PHP_SELF . "' method='post' onsubmit='return mlw_validateForm()' >";
150
 
151
- //Check to see if user is logged in, then ask for contact if not
152
- if ( is_user_logged_in() )
153
  {
154
- //Retrieve current user information and save into text fields for contact information
155
- $current_user = wp_get_current_user();
156
- if ($mlw_quiz_options->user_name != 2)
157
- {
158
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
159
- $mlw_display .= "<input type='text' name='mlwUserName' value='".$current_user->display_name."' />";
160
- $mlw_display .= "<br /><br />";
161
-
162
- }
163
- if ($mlw_quiz_options->user_comp != 2)
164
- {
165
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
166
- $mlw_display .= "<input type='text' name='mlwUserComp' value='' />";
167
- $mlw_display .= "<br /><br />";
168
-
169
- }
170
- if ($mlw_quiz_options->user_email != 2)
171
- {
172
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
173
- $mlw_display .= "<input type='text' name='mlwUserEmail' value='".$current_user->user_email."' />";
174
- $mlw_display .= "<br /><br />";
175
-
176
- }
177
- if ($mlw_quiz_options->user_phone != 2)
178
- {
179
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
180
- $mlw_display .= "<input type='text' name='mlwUserPhone' value='' />";
181
- $mlw_display .= "<br /><br />";
182
-
183
- }
184
- }
185
- else
186
- {
187
- //See if the site wants to ask for any contact information, then ask for it
188
- if ($mlw_quiz_options->user_name != 2)
189
- {
190
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
191
- $mlw_display .= "<input type='text' name='mlwUserName' value='' />";
192
- $mlw_display .= "<br /><br />";
193
-
194
- }
195
- if ($mlw_quiz_options->user_comp != 2)
196
- {
197
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
198
- $mlw_display .= "<input type='text' name='mlwUserComp' value='' />";
199
- $mlw_display .= "<br /><br />";
200
-
201
- }
202
- if ($mlw_quiz_options->user_email != 2)
203
- {
204
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
205
- $mlw_display .= "<input type='text' name='mlwUserEmail' value='' />";
206
- $mlw_display .= "<br /><br />";
207
-
208
- }
209
- if ($mlw_quiz_options->user_phone != 2)
210
- {
211
- $mlw_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
212
- $mlw_display .= "<input type='text' name='mlwUserPhone' value='' />";
213
- $mlw_display .= "<br /><br />";
214
-
215
- }
216
  }
217
 
218
  //Display the questions
@@ -222,32 +232,32 @@ function mlw_quiz_shortcode($atts)
222
  {
223
  if ($mlw_question->answer_one != "")
224
  {
225
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='1' />".$mlw_question->answer_one;
226
  $mlw_display .= "<br />";
227
  }
228
  if ($mlw_question->answer_two != "")
229
  {
230
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='2' />".$mlw_question->answer_two;
231
  $mlw_display .= "<br />";
232
  }
233
  if ($mlw_question->answer_three != "")
234
  {
235
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='3' />".$mlw_question->answer_three;
236
  $mlw_display .= "<br />";
237
  }
238
  if ($mlw_question->answer_four != "")
239
  {
240
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='4' />".$mlw_question->answer_four;
241
  $mlw_display .= "<br />";
242
  }
243
  if ($mlw_question->answer_five != "")
244
  {
245
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='5' />".$mlw_question->answer_five;
246
  $mlw_display .= "<br />";
247
  }
248
  if ($mlw_question->answer_six != "")
249
  {
250
- $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='6' />".$mlw_question->answer_six;
251
  $mlw_display .= "<br />";
252
  }
253
  }
@@ -334,7 +344,11 @@ function mlw_quiz_shortcode($atts)
334
  $mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
335
  $mlw_display .= "<label for='mlwQuizComments'>".$mlw_message_comments."</label>";
336
  $mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
337
- $mlw_display .= "<br />";
 
 
 
 
338
  }
339
  $mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
340
  $mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
48
  $mlw_user_email = $_POST["mlwUserEmail"];
49
  $mlw_user_phone = $_POST["mlwUserPhone"];
50
  $mlw_spam_email = $_POST["email"];
51
+
52
+ function mlwDisplayContactInfo($mlw_quiz_options)
53
+ {
54
+ $mlw_contact_display = "";
55
+ //Check to see if user is logged in, then ask for contact if not
56
+ if ( is_user_logged_in() )
57
+ {
58
+ //Retrieve current user information and save into text fields for contact information
59
+ $current_user = wp_get_current_user();
60
+ if ($mlw_quiz_options->user_name != 2)
61
+ {
62
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
63
+ $mlw_contact_display .= "<input type='text' name='mlwUserName' value='".$current_user->display_name."' />";
64
+ $mlw_contact_display .= "<br /><br />";
65
+
66
+ }
67
+ if ($mlw_quiz_options->user_comp != 2)
68
+ {
69
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
70
+ $mlw_contact_display .= "<input type='text' name='mlwUserComp' value='' />";
71
+ $mlw_contact_display .= "<br /><br />";
72
+
73
+ }
74
+ if ($mlw_quiz_options->user_email != 2)
75
+ {
76
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
77
+ $mlw_contact_display .= "<input type='text' name='mlwUserEmail' value='".$current_user->user_email."' />";
78
+ $mlw_contact_display .= "<br /><br />";
79
+
80
+ }
81
+ if ($mlw_quiz_options->user_phone != 2)
82
+ {
83
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
84
+ $mlw_contact_display .= "<input type='text' name='mlwUserPhone' value='' />";
85
+ $mlw_contact_display .= "<br /><br />";
86
+
87
+ }
88
+ }
89
+ else
90
+ {
91
+ //See if the site wants to ask for any contact information, then ask for it
92
+ if ($mlw_quiz_options->user_name != 2)
93
+ {
94
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
95
+ $mlw_contact_display .= "<input type='text' name='mlwUserName' value='' />";
96
+ $mlw_contact_display .= "<br /><br />";
97
+
98
+ }
99
+ if ($mlw_quiz_options->user_comp != 2)
100
+ {
101
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
102
+ $mlw_contact_display .= "<input type='text' name='mlwUserComp' value='' />";
103
+ $mlw_contact_display .= "<br /><br />";
104
+
105
+ }
106
+ if ($mlw_quiz_options->user_email != 2)
107
+ {
108
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
109
+ $mlw_contact_display .= "<input type='text' name='mlwUserEmail' value='' />";
110
+ $mlw_contact_display .= "<br /><br />";
111
+
112
+ }
113
+ if ($mlw_quiz_options->user_phone != 2)
114
+ {
115
+ $mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
116
+ $mlw_contact_display .= "<input type='text' name='mlwUserPhone' value='' />";
117
+ $mlw_contact_display .= "<br /><br />";
118
+
119
+ }
120
+ }
121
+ return $mlw_contact_display;
122
+ }
123
 
124
  /*
125
  The following code is for displaying the quiz and completion screen
220
  $mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
221
  $mlw_display .= "<form name='quizForm' action='" . $PHP_SELF . "' method='post' onsubmit='return mlw_validateForm()' >";
222
 
223
+ if ($mlw_quiz_options->contact_info_location == 0)
 
224
  {
225
+ $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  }
227
 
228
  //Display the questions
232
  {
233
  if ($mlw_question->answer_one != "")
234
  {
235
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='1' /> ".$mlw_question->answer_one;
236
  $mlw_display .= "<br />";
237
  }
238
  if ($mlw_question->answer_two != "")
239
  {
240
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='2' /> ".$mlw_question->answer_two;
241
  $mlw_display .= "<br />";
242
  }
243
  if ($mlw_question->answer_three != "")
244
  {
245
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='3' /> ".$mlw_question->answer_three;
246
  $mlw_display .= "<br />";
247
  }
248
  if ($mlw_question->answer_four != "")
249
  {
250
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='4' /> ".$mlw_question->answer_four;
251
  $mlw_display .= "<br />";
252
  }
253
  if ($mlw_question->answer_five != "")
254
  {
255
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='5' /> ".$mlw_question->answer_five;
256
  $mlw_display .= "<br />";
257
  }
258
  if ($mlw_question->answer_six != "")
259
  {
260
+ $mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='6' /> ".$mlw_question->answer_six;
261
  $mlw_display .= "<br />";
262
  }
263
  }
344
  $mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
345
  $mlw_display .= "<label for='mlwQuizComments'>".$mlw_message_comments."</label>";
346
  $mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
347
+ $mlw_display .= "<br /><br />";
348
+ }
349
+ if ($mlw_quiz_options->contact_info_location == 1)
350
+ {
351
+ $mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
352
  }
353
  $mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
354
  $mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
includes/mlw_quiz_install.php CHANGED
@@ -53,6 +53,8 @@ function mlw_quiz_activate()
53
  send_user_email INT NOT NULL,
54
 
55
  send_admin_email INT NOT NULL,
 
 
56
 
57
  user_name INT NOT NULL,
58
 
53
  send_user_email INT NOT NULL,
54
 
55
  send_admin_email INT NOT NULL,
56
+
57
+ contact_info_location INT NOT NULL,
58
 
59
  user_name INT NOT NULL,
60
 
includes/mlw_quiz_options.php CHANGED
@@ -36,6 +36,7 @@ function mlw_generate_quiz_options()
36
  $question_type = $_POST["question_type"];
37
  $comments = $_POST["comments"];
38
  $hint = $_POST["hint"];
 
39
 
40
  //Variables from edit question form
41
  $edit_question_success = $_POST["edit_question"];
@@ -105,7 +106,7 @@ function mlw_generate_quiz_options()
105
  $quiz_id = $_POST["quiz_id"];
106
  $table_name = $wpdb->prefix . "mlw_questions";
107
  $insert = "INSERT INTO " . $table_name .
108
- " (question_id, quiz_id, question_name, answer_one, answer_one_points, answer_two, answer_two_points, answer_three, answer_three_points, answer_four, answer_four_points, answer_five, answer_five_points, answer_six, answer_six_points, correct_answer, comments, hints, question_order, question_type, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '" . $answer_one . "', ".$answer_one_points.", '" . $answer_two . "', ".$answer_two_points.", '" . $answer_three . "', ".$answer_three_points.", '" . $answer_four . "', ".$answer_four_points.", '" . $answer_five . "', ".$answer_five_points.", '" . $answer_six . "', ".$answer_six_points.", ".$correct_answer.", '".$comments."', '".$hint."', 1, '".$question_type."', 0)";
109
  $results = $wpdb->query( $insert );
110
  $hasCreatedQuestion = true;
111
 
@@ -178,6 +179,7 @@ function mlw_generate_quiz_options()
178
  $mlw_randomness_order = $_POST["randomness_order"];
179
  $mlw_send_user_email = $_POST["sendUserEmail"];
180
  $mlw_send_admin_email = $_POST["sendAdminEmail"];
 
181
  $mlw_user_name = $_POST["userName"];
182
  $mlw_user_comp = $_POST["userComp"];
183
  $mlw_user_email = $_POST["userEmail"];
@@ -189,7 +191,7 @@ function mlw_generate_quiz_options()
189
  if ($save_options_success == "confirmation")
190
  {
191
  $quiz_id = $_POST["quiz_id"];
192
- $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', 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."' WHERE quiz_id=".$quiz_id;
193
  $results = $wpdb->query( $update );
194
  $hasUpdatedOptions = true;
195
 
@@ -364,6 +366,9 @@ function mlw_generate_quiz_options()
364
  $j(function() {
365
  $j( "#sendAdminEmail" ).buttonset();
366
  });
 
 
 
367
  $j(function() {
368
  $j( "#userName" ).buttonset();
369
  });
@@ -563,7 +568,7 @@ function mlw_generate_quiz_options()
563
  else $alternate = " class=\"alternate\"";
564
  $question_list .= "<tr{$alternate}>";
565
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
566
- $question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES))."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_one, ENT_QUOTES))."','".$mlw_question_info->answer_one_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_two, ENT_QUOTES))."','".$mlw_question_info->answer_two_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_three, ENT_QUOTES))."','".$mlw_question_info->answer_three_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_four, ENT_QUOTES))."','".$mlw_question_info->answer_four_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_five, ENT_QUOTES))."','".$mlw_question_info->answer_five_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_six, ENT_QUOTES))."','".$mlw_question_info->answer_six_points."','".$mlw_question_info->correct_answer."','".$mlw_question_info->comments."','".$mlw_question_info->hints."', '".$mlw_question_info->question_order."', '".$mlw_question_info->question_type."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
567
  $question_list .= "</tr>";
568
  }
569
 
@@ -698,9 +703,9 @@ function mlw_generate_quiz_options()
698
  </tr>
699
  <tr valign="top">
700
  <th scope="row">Comment Field?</th>
701
- <td><input type="radio" id="commentsRadio1" name="comments" checked="checked" value=0 /><label for="commentsRadio1">Small Text Field</label></td>
702
  <td><input type="radio" id="commentsRadio3" name="comments" value=2 /><label for="commentsRadio3">Large Text Field</label></td>
703
- <td><input type="radio" id="commentsRadio2" name="comments" value=1 /><label for="commentsRadio2">None</label></td>
704
  </tr>
705
  <tr valign="top">
706
  <th scope="row">Hint</th>
@@ -710,6 +715,14 @@ function mlw_generate_quiz_options()
710
  cursor:hand;"/>
711
  </td>
712
  </tr>
 
 
 
 
 
 
 
 
713
  </thead>
714
  </table>
715
  <?php
@@ -856,7 +869,7 @@ function mlw_generate_quiz_options()
856
  <tr valign="top">
857
  <th scope="row">Question Order</th>
858
  <td>
859
- <input type="text" name="edit_question_order" value="" id="edit_question_order" style="border-color:#000000;
860
  color:#3300CC;
861
  cursor:hand;"/>
862
  </td>
@@ -1049,9 +1062,10 @@ function mlw_generate_quiz_options()
1049
  </td>
1050
  </tr>
1051
  </table>
1052
-
1053
  </div>
1054
  </div>
 
1055
  <?php echo "</form>"; ?>
1056
  </div>
1057
  <div id="tabs-3">
@@ -1077,6 +1091,13 @@ function mlw_generate_quiz_options()
1077
  <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>
1078
  </div></td>
1079
  </tr>
 
 
 
 
 
 
 
1080
  <tr valign="top">
1081
  <th scope="row"><label for="userName">Should we ask for user's name?</label></th>
1082
  <td><div id="userName">
@@ -1135,6 +1156,7 @@ function mlw_generate_quiz_options()
1135
  <td><input name="adminEmail" type="email" id="adminEmail" value="<?php echo $mlw_quiz_options->admin_email; ?>" class="regular-text" /></td>
1136
  </tr>
1137
  </table>
 
1138
  <?php echo "</form>"; ?>
1139
  </div>
1140
  <div id="tabs-4">
@@ -1197,6 +1219,7 @@ function mlw_generate_quiz_options()
1197
  </td>
1198
  </tr>
1199
  </table>
 
1200
  </form>
1201
  </div>
1202
  </div>
36
  $question_type = $_POST["question_type"];
37
  $comments = $_POST["comments"];
38
  $hint = $_POST["hint"];
39
+ $new_question_order = $_POST["new_question_order"];
40
 
41
  //Variables from edit question form
42
  $edit_question_success = $_POST["edit_question"];
106
  $quiz_id = $_POST["quiz_id"];
107
  $table_name = $wpdb->prefix . "mlw_questions";
108
  $insert = "INSERT INTO " . $table_name .
109
+ " (question_id, quiz_id, question_name, answer_one, answer_one_points, answer_two, answer_two_points, answer_three, answer_three_points, answer_four, answer_four_points, answer_five, answer_five_points, answer_six, answer_six_points, correct_answer, comments, hints, question_order, question_type, deleted) VALUES (NULL , ".$quiz_id.", '" . $question_name . "' , '" . $answer_one . "', ".$answer_one_points.", '" . $answer_two . "', ".$answer_two_points.", '" . $answer_three . "', ".$answer_three_points.", '" . $answer_four . "', ".$answer_four_points.", '" . $answer_five . "', ".$answer_five_points.", '" . $answer_six . "', ".$answer_six_points.", ".$correct_answer.", '".$comments."', '".$hint."', ".$new_question_order.", '".$question_type."', 0)";
110
  $results = $wpdb->query( $insert );
111
  $hasCreatedQuestion = true;
112
 
179
  $mlw_randomness_order = $_POST["randomness_order"];
180
  $mlw_send_user_email = $_POST["sendUserEmail"];
181
  $mlw_send_admin_email = $_POST["sendAdminEmail"];
182
+ $mlw_contact_location = $_POST["contact_info_location"];
183
  $mlw_user_name = $_POST["userName"];
184
  $mlw_user_comp = $_POST["userComp"];
185
  $mlw_user_email = $_POST["userEmail"];
191
  if ($save_options_success == "confirmation")
192
  {
193
  $quiz_id = $_POST["quiz_id"];
194
+ $update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET system='".$mlw_system."', send_user_email='".$mlw_send_user_email."', send_admin_email='".$mlw_send_admin_email."', 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."' WHERE quiz_id=".$quiz_id;
195
  $results = $wpdb->query( $update );
196
  $hasUpdatedOptions = true;
197
 
366
  $j(function() {
367
  $j( "#sendAdminEmail" ).buttonset();
368
  });
369
+ $j(function() {
370
+ $j( "#contact_info_location" ).buttonset();
371
+ });
372
  $j(function() {
373
  $j( "#userName" ).buttonset();
374
  });
568
  else $alternate = " class=\"alternate\"";
569
  $question_list .= "<tr{$alternate}>";
570
  $question_list .= "<td><span style='font-size:16px;'>" . $mlw_question_info->question_order . "</span></td>";
571
+ $question_list .= "<td class='post-title column-title'><span style='font-size:16px;'>" . $mlw_question_info->question_name ."</span><div><span style='color:green;font-size:12px;'><a onclick=\"editQuestion('".$mlw_question_info->question_id."','".str_replace('"', '\"', str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->question_name, ENT_QUOTES)))."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_one, ENT_QUOTES))."','".$mlw_question_info->answer_one_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_two, ENT_QUOTES))."','".$mlw_question_info->answer_two_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_three, ENT_QUOTES))."','".$mlw_question_info->answer_three_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_four, ENT_QUOTES))."','".$mlw_question_info->answer_four_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_five, ENT_QUOTES))."','".$mlw_question_info->answer_five_points."','".str_replace("'", "\'", htmlspecialchars_decode($mlw_question_info->answer_six, ENT_QUOTES))."','".$mlw_question_info->answer_six_points."','".$mlw_question_info->correct_answer."','".$mlw_question_info->comments."','".$mlw_question_info->hints."', '".$mlw_question_info->question_order."', '".$mlw_question_info->question_type."')\" href='#'>Edit</a> | <a onclick=\"deleteQuestion('".$mlw_question_info->question_id."')\" href='#'>Delete</a></span></div></td>";
572
  $question_list .= "</tr>";
573
  }
574
 
703
  </tr>
704
  <tr valign="top">
705
  <th scope="row">Comment Field?</th>
706
+ <td><input type="radio" id="commentsRadio1" name="comments" value=0 /><label for="commentsRadio1">Small Text Field</label></td>
707
  <td><input type="radio" id="commentsRadio3" name="comments" value=2 /><label for="commentsRadio3">Large Text Field</label></td>
708
+ <td><input type="radio" id="commentsRadio2" name="comments" checked="checked" value=1 /><label for="commentsRadio2">None</label></td>
709
  </tr>
710
  <tr valign="top">
711
  <th scope="row">Hint</th>
715
  cursor:hand;"/>
716
  </td>
717
  </tr>
718
+ <tr valign="top">
719
+ <th scope="row">Question Order</th>
720
+ <td>
721
+ <input type="number" step="1" min="1" name="new_question_order" value="1" id="new_question_order" style="border-color:#000000;
722
+ color:#3300CC;
723
+ cursor:hand;"/>
724
+ </td>
725
+ </tr>
726
  </thead>
727
  </table>
728
  <?php
869
  <tr valign="top">
870
  <th scope="row">Question Order</th>
871
  <td>
872
+ <input type="number" step="1" min="1" name="edit_question_order" value="" id="edit_question_order" style="border-color:#000000;
873
  color:#3300CC;
874
  cursor:hand;"/>
875
  </td>
1062
  </td>
1063
  </tr>
1064
  </table>
1065
+
1066
  </div>
1067
  </div>
1068
+ <button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button>
1069
  <?php echo "</form>"; ?>
1070
  </div>
1071
  <div id="tabs-3">
1091
  <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>
1092
  </div></td>
1093
  </tr>
1094
+ <tr valign="top">
1095
+ <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>
1096
+ <td><div id="contact_info_location">
1097
+ <input type="radio" id="radio25" name="contact_info_location" <?php if ($mlw_quiz_options->contact_info_location == 0) {echo 'checked="checked"';} ?> value='0' /><label for="radio25">Beginning</label>
1098
+ <input type="radio" id="radio26" name="contact_info_location" <?php if ($mlw_quiz_options->contact_info_location == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio26">End</label>
1099
+ </div></td>
1100
+ </tr>
1101
  <tr valign="top">
1102
  <th scope="row"><label for="userName">Should we ask for user's name?</label></th>
1103
  <td><div id="userName">
1156
  <td><input name="adminEmail" type="email" id="adminEmail" value="<?php echo $mlw_quiz_options->admin_email; ?>" class="regular-text" /></td>
1157
  </tr>
1158
  </table>
1159
+ <button id="save_options_button" onclick="javascript: document.quiz_options_form.submit();">Save Options</button>
1160
  <?php echo "</form>"; ?>
1161
  </div>
1162
  <div id="tabs-4">
1219
  </td>
1220
  </tr>
1221
  </table>
1222
+ <button id="save_template_button" onclick="javascript: document.quiz_leaderboard_options_form.submit();">Save Leaderboard Options</button>
1223
  </form>
1224
  </div>
1225
  </div>
includes/mlw_update.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  function mlw_quiz_update()
4
  {
5
- $data = "0.9.5";
6
  if ( ! get_option('mlw_quiz_master_version'))
7
  {
8
  add_option('mlw_quiz_master_version' , $data);
@@ -58,6 +58,15 @@ function mlw_quiz_update()
58
  $results = $wpdb->query( $update_sql );
59
  }
60
 
 
 
 
 
 
 
 
 
 
61
 
62
  global $wpdb;
63
  $table_name = $wpdb->prefix . "mlw_questions";
2
 
3
  function mlw_quiz_update()
4
  {
5
+ $data = "0.9.6";
6
  if ( ! get_option('mlw_quiz_master_version'))
7
  {
8
  add_option('mlw_quiz_master_version' , $data);
58
  $results = $wpdb->query( $update_sql );
59
  }
60
 
61
+ //Update 0.9.6
62
+ if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'contact_info_location'") != "contact_info_location")
63
+ {
64
+ $sql = "ALTER TABLE ".$table_name." ADD contact_info_location INT NOT NULL AFTER send_admin_email";
65
+ $results = $wpdb->query( $sql );
66
+ $update_sql = "UPDATE ".$table_name." SET contact_info_location=0";
67
+ $results = $wpdb->query( $update_sql );
68
+ }
69
+
70
 
71
  global $wpdb;
72
  $table_name = $wpdb->prefix . "mlw_questions";
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: 0.9.5
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
3
  /*
4
  Plugin Name: Quiz Master Next
5
  Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
6
+ Version: 0.9.6
7
  Author: Frank Corso
8
  Author URI: http://www.mylocalwebstop.com/
9
  Plugin URI: http://www.mylocalwebstop.com/
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: fpcorso
3
  Tags: quiz, test, score, survey, contact
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8
6
- Stable tag: 0.9.5
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.
@@ -16,7 +16,7 @@ Features include:
16
 
17
  * Allows for Unlimited Quizzes, Tests, Surveys, Contact Forms, etc..
18
  * Allows for Unlimited Questions in each Quiz
19
- * Can ask for user's contact information
20
  * Can email user after taking the quiz
21
  * Can email an admin after a user takes the quiz
22
  * Can score the quiz using an incorrect/correct system, a points based system, or a not-graded system
@@ -61,6 +61,15 @@ Feel free to use the help page within the plugin or from the contact page at myl
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
 
 
 
 
64
  = 0.9.5 (January 19, 2014) =
65
  * Added Ability To Edit %QUESTIONS_ANSWERS% Template
66
  * Changed Name Of Support Page To Help Page
@@ -200,6 +209,9 @@ Feel free to use the help page within the plugin or from the contact page at myl
200
 
201
  == Upgrade Notice ==
202
 
 
 
 
203
  = 0.9.5 =
204
  Upgrade to be able to edit the %QUESTIONS_ANSWERS% template. Also, minor design changes on Quiz Options page.
205
 
3
  Tags: quiz, test, score, survey, contact
4
  Requires at least: 3.0.1
5
  Tested up to: 3.8
6
+ Stable tag: 0.9.6
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.
16
 
17
  * Allows for Unlimited Quizzes, Tests, Surveys, Contact Forms, etc..
18
  * Allows for Unlimited Questions in each Quiz
19
+ * Can ask for user's contact information at beginning or end of quiz
20
  * Can email user after taking the quiz
21
  * Can email an admin after a user takes the quiz
22
  * Can score the quiz using an incorrect/correct system, a points based system, or a not-graded system
61
 
62
  == Changelog ==
63
 
64
+ = 0.9.6 (January 21, 2014) =
65
+ * Added Ability To Edit Question Order When Adding Questions
66
+ * Added Ability To Choose Whether Contact Info Is Asked For At Beginning Or End Of Quiz
67
+ * Defaulted Question Comment Field To None On New Questions
68
+ * Fixed Double Quote Bug
69
+ * Enhanced Monthly Stat Widget
70
+ * Minor Design Change To Quiz Total Stats Widget
71
+ * Minor Design Changes To Quiz Options Page
72
+
73
  = 0.9.5 (January 19, 2014) =
74
  * Added Ability To Edit %QUESTIONS_ANSWERS% Template
75
  * Changed Name Of Support Page To Help Page
209
 
210
  == Upgrade Notice ==
211
 
212
+ = 0.9.6 =
213
+ Upgrade to be able to choose whether contact information is asked for at beginning or end of the quiz. Also, added ability to edit question order when adding new questions. Several minor design changes on admin side. Fixed double quote bug.
214
+
215
  = 0.9.5 =
216
  Upgrade to be able to edit the %QUESTIONS_ANSWERS% template. Also, minor design changes on Quiz Options page.
217