From 813b15903ace58de281b9c48682c217bdd7be1a0 Mon Sep 17 00:00:00 2001 From: Jonathan Bossenger Date: Wed, 11 Dec 2024 18:36:02 +0200 Subject: [PATCH] Fix fatal error when unenrolled users view a lesson without a quiz (#3058) --- 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 );