Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid caching when getting course structure #7654

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/fix-module-lesson-order
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Avoid caching when getting course structure
8 changes: 2 additions & 6 deletions includes/blocks/class-sensei-course-outline-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public function register_blocks() {
],
Sensei()->assets->src_path( 'blocks/course-outline/lesson-block' )
);

}

/**
Expand Down Expand Up @@ -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 );

Expand All @@ -183,7 +182,6 @@ public function get_block_structure() {
'attributes' => $attributes,
'blocks' => $structure,
];

}

/**
Expand Down Expand Up @@ -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;

}

/**
Expand All @@ -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 );

Expand Down Expand Up @@ -333,5 +330,4 @@ public function frontend_notices() {
Sensei()->notices->add_notice( $message, 'info', 'sensei-course-outline-drafts' );
}
}

}
Loading