Changeset 3362701
- Timestamp:
- 09/16/2025 05:18:41 PM (7 months ago)
- Location:
- chained-quiz/trunk
- Files:
-
- 3 edited
-
chained-quiz.php (modified) (1 diff)
-
helpers/htmlhelper.php (modified) (1 diff)
-
models/quiz.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chained-quiz/trunk/chained-quiz.php
r3362561 r3362701 5 5 Description: Create a chained quiz where the upcoming questions can depend on the previous answer 6 6 Author: Kiboko Labs 7 Version: 1.3. 47 Version: 1.3.5 8 8 Author URI: http://calendarscripts.info/ 9 9 License: GPLv2 or later -
chained-quiz/trunk/helpers/htmlhelper.php
r3362561 r3362701 131 131 132 132 // If user is logged in, check if the completion belongs to them 133 if (is_user_logged_in() ) {133 if (is_user_logged_in() or $completion->user_id ) { 134 134 return ($completion->user_id == $user_ID); 135 135 } else { -
chained-quiz/trunk/models/quiz.php
r3362561 r3362701 167 167 168 168 $GLOBALS['chained_completion_id'] = $completion_id; 169 $GLOBALS['chained_result_id'] = @$result->id;169 $GLOBALS['chained_result_id'] = $result->id ?? 0; 170 170 $output = do_shortcode($output); 171 171 $output = wpautop($output); … … 176 176 177 177 // now insert in completed 178 if(!empty($_COOKIE['chained_completion_id'.$quiz->id])) { 179 $wpdb->query( $wpdb->prepare("UPDATE ".CHAINED_COMPLETED." SET 180 quiz_id = %d, points = %f, result_id = %d, datetime = NOW(), ip = %s, user_id = %d, 181 snapshot = %s, source_url=%s, email=%s WHERE id=%d", 182 $quiz->id, $points, @$result->id, chained_user_ip(), $user_id, $output, 183 $source_url, $user_email, $completion_id)); 178 if(!empty($_COOKIE['chained_completion_id'.$quiz->id])) { 179 // if for whatever reason it's already completed don't override it 180 $is_completed = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".CHAINED_COMPLETED." 181 WHERE id=%d snapshot IS NOT NULL", $completion_id)); 182 183 if(!$is_completed) { 184 $wpdb->query( $wpdb->prepare("UPDATE ".CHAINED_COMPLETED." SET 185 quiz_id = %d, points = %f, result_id = %d, datetime = NOW(), ip = %s, user_id = %d, 186 snapshot = %s, source_url=%s, email=%s WHERE id=%d", 187 $quiz->id, $points, @$result->id, chained_user_ip(), $user_id, $output, 188 $source_url, $user_email, $completion_id)); 189 setcookie('chained_completion_id'.$quiz->id, '', time() - 30*24*3600, '/'); 190 } 184 191 185 192 $taking_id = $_COOKIE['chained_completion_id'.$quiz->id]; 186 setcookie('chained_completion_id'.$quiz->id, '', time() - 30*24*3600, '/'); 193 187 194 } 188 195 else {
Note: See TracChangeset
for help on using the changeset viewer.