diff --git a/includes/class-sensei-lesson.php b/includes/class-sensei-lesson.php index f1e1cfa1b5..3ffaa788f0 100755 --- a/includes/class-sensei-lesson.php +++ b/includes/class-sensei-lesson.php @@ -5061,8 +5061,6 @@ public static function footer_quiz_call_to_action( $lesson_id = 0, $user_id = 0 * @return bool */ public static function should_show_lesson_actions( int $lesson_id, int $user_id = 0 ): bool { - $show_actions = true; - $user_id = empty( $user_id ) ? get_current_user_id() : $user_id; $lesson_prerequisite = (int) get_post_meta( $lesson_id, '_lesson_prerequisite', true ); @@ -5071,12 +5069,12 @@ public static function should_show_lesson_actions( int $lesson_id, int $user_id // If the user hasn't completed the prerequisites then hide the current actions. // (If the user is either the lesson creator or admin, show actions). - $show_actions = Sensei_Utils::user_completed_lesson( $lesson_prerequisite, $user_id ) + return Sensei_Utils::user_completed_lesson( $lesson_prerequisite, $user_id ) || Sensei()->lesson->is_lesson_author( $lesson_id, $user_id ) || current_user_can( 'manage_options' ); } - return apply_filter( 'sensei_should_show_lesson_actions', $show_actions ); + return true; } /** diff --git a/tests/unit-tests/blocks/course-theme/test-class-quiz-actions.php b/tests/unit-tests/blocks/course-theme/test-class-quiz-actions.php index 055d27a89a..0ba597c3b6 100644 --- a/tests/unit-tests/blocks/course-theme/test-class-quiz-actions.php +++ b/tests/unit-tests/blocks/course-theme/test-class-quiz-actions.php @@ -1,17 +1,10 @@ render(); + $result_for_other_pages = ( new \Sensei\Blocks\Course_Theme\Quiz_Actions() )->render(); $sensei_question_loop['current_page'] = $sensei_question_loop['total_pages']; - $result_for_last_page = ( new Quiz_Actions() )->render(); + $result_for_last_page = ( new \Sensei\Blocks\Course_Theme\Quiz_Actions() )->render(); /* Assert */ $this->assertStringContainsString( 'sensei-item-no-display', $result_for_other_pages );