From 5f7ffb7935d658c64da5cb71714bab7776ca73e3 Mon Sep 17 00:00:00 2001 From: Dmitry Merkushin Date: Thu, 1 Aug 2024 16:41:24 -0600 Subject: [PATCH] Avoid caching when getting course structure --- changelog/fix-module-lesson-order | 4 ++++ includes/blocks/class-sensei-course-outline-block.php | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 changelog/fix-module-lesson-order diff --git a/changelog/fix-module-lesson-order b/changelog/fix-module-lesson-order new file mode 100644 index 0000000000..95e5967b77 --- /dev/null +++ b/changelog/fix-module-lesson-order @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Avoid caching when getting course structure diff --git a/includes/blocks/class-sensei-course-outline-block.php b/includes/blocks/class-sensei-course-outline-block.php index 94f8a71742..34845f5d9d 100644 --- a/includes/blocks/class-sensei-course-outline-block.php +++ b/includes/blocks/class-sensei-course-outline-block.php @@ -105,7 +105,6 @@ public function register_blocks() { ], Sensei()->assets->src_path( 'blocks/course-outline/lesson-block' ) ); - } /** @@ -174,7 +173,7 @@ public function get_block_structure() { $context = 'edit'; } - $structure = Sensei_Course_Structure::instance( $post->ID )->get( $context ); + $structure = Sensei_Course_Structure::instance( $post->ID )->get( $context, wp_using_ext_object_cache() ); $this->add_block_attributes( $structure ); @@ -183,7 +182,6 @@ public function get_block_structure() { 'attributes' => $attributes, 'blocks' => $structure, ]; - } /** @@ -233,7 +231,6 @@ public function render_course_outline_block( $attributes ) { $this->block_content = $this->course->render_course_outline_block( $outline ); return $this->block_content; - } /** @@ -251,7 +248,7 @@ public function frontend_notices() { } $course_id = $post->ID; - $structure = Sensei_Course_Structure::instance( $course_id )->get( 'view' ); + $structure = Sensei_Course_Structure::instance( $course_id )->get( 'view', wp_using_ext_object_cache() ); $has_draft = $this->has_draft( $structure ); $can_edit_course = Sensei_Course::can_current_user_edit_course( $course_id ); @@ -333,5 +330,4 @@ public function frontend_notices() { Sensei()->notices->add_notice( $message, 'info', 'sensei-course-outline-drafts' ); } } - }