llms_update_3160_update_quiz_to_lesson_rels()
Ensure quizzes backreference their parent lessons
Return Return
(void)
Source Source
File: includes/functions/updates/llms-functions-updates-3160.php
function llms_update_3160_update_quiz_to_lesson_rels() { if ( 'complete' !== get_transient( 'llms_update_3160_update_attempt_question_data' ) ) { return true; } global $wpdb; $ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_llms_quiz_enabled' AND meta_value = 'yes'" ); foreach ( $ids as $id ) { $lesson = llms_get_post( $id ); if ( $lesson ) { $quiz_id = $lesson->get( 'quiz' ); if ( $quiz_id ) { $quiz = llms_get_post( $quiz_id ); $quiz->set( 'lesson_id', $id ); } } } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.0 | Introduced. |