Skip to content

Commit 5f7ffb7

Browse files
committed
Avoid caching when getting course structure
1 parent a13fc40 commit 5f7ffb7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

changelog/fix-module-lesson-order

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Avoid caching when getting course structure

includes/blocks/class-sensei-course-outline-block.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ public function register_blocks() {
105105
],
106106
Sensei()->assets->src_path( 'blocks/course-outline/lesson-block' )
107107
);
108-
109108
}
110109

111110
/**
@@ -174,7 +173,7 @@ public function get_block_structure() {
174173
$context = 'edit';
175174
}
176175

177-
$structure = Sensei_Course_Structure::instance( $post->ID )->get( $context );
176+
$structure = Sensei_Course_Structure::instance( $post->ID )->get( $context, wp_using_ext_object_cache() );
178177

179178
$this->add_block_attributes( $structure );
180179

@@ -183,7 +182,6 @@ public function get_block_structure() {
183182
'attributes' => $attributes,
184183
'blocks' => $structure,
185184
];
186-
187185
}
188186

189187
/**
@@ -233,7 +231,6 @@ public function render_course_outline_block( $attributes ) {
233231

234232
$this->block_content = $this->course->render_course_outline_block( $outline );
235233
return $this->block_content;
236-
237234
}
238235

239236
/**
@@ -251,7 +248,7 @@ public function frontend_notices() {
251248
}
252249

253250
$course_id = $post->ID;
254-
$structure = Sensei_Course_Structure::instance( $course_id )->get( 'view' );
251+
$structure = Sensei_Course_Structure::instance( $course_id )->get( 'view', wp_using_ext_object_cache() );
255252
$has_draft = $this->has_draft( $structure );
256253
$can_edit_course = Sensei_Course::can_current_user_edit_course( $course_id );
257254

@@ -333,5 +330,4 @@ public function frontend_notices() {
333330
Sensei()->notices->add_notice( $message, 'info', 'sensei-course-outline-drafts' );
334331
}
335332
}
336-
337333
}

0 commit comments

Comments
 (0)