From 6d719c93a313d16bb4984945ad43ed71ba1e077b Mon Sep 17 00:00:00 2001 From: Jonathan Bossenger Date: Tue, 10 Dec 2024 12:46:08 +0200 Subject: [PATCH] If no quizzes exist in the lesson, return early --- wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php b/wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php index 73b77ddea..5f51defde 100644 --- a/wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php +++ b/wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php @@ -179,6 +179,9 @@ function update_quiz_actions( $block_content ) { function is_quiz_ungraded() { $lesson_id = Sensei_Utils::get_current_lesson(); $quiz_id = Sensei()->lesson->lesson_quizzes( $lesson_id ); + if ( ! $quiz_id ) { + return false; + } $user_id = get_current_user_id(); $quiz_progress = Sensei()->quiz_progress_repository->get( $quiz_id, $user_id );