Skip to content

Commit 813b159

Browse files
Fix fatal error when unenrolled users view a lesson without a quiz (#3058)
1 parent 6ede536 commit 813b159

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

wp-content/themes/pub/wporg-learn-2024/inc/block-hooks.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ function update_quiz_actions( $block_content ) {
179179
function is_quiz_ungraded() {
180180
$lesson_id = Sensei_Utils::get_current_lesson();
181181
$quiz_id = Sensei()->lesson->lesson_quizzes( $lesson_id );
182+
if ( ! $quiz_id ) {
183+
return false;
184+
}
182185
$user_id = get_current_user_id();
183186
$quiz_progress = Sensei()->quiz_progress_repository->get( $quiz_id, $user_id );
184187

0 commit comments

Comments
 (0)