Repository navigation
fix(academy): show course steps in PublishPress workflow statuses - #1110
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Lessons, topics and quizzes with a PublishPress Statuses workflow status (Ready, In Progress and so on) don't appear in a course's front-end listing, for anyone, including administrators. The course builder shows them correctly. Steps in Draft or Pending do appear.
In Data analytics: Full-time bootcamp (6988), this hides:
Cause
LDLMS_Course_Steps::get_step_post_statuses()(sfwd-lms/includes/classes/class-ldlms-model-course-steps.php) limits the steps query toget_post_stati( array( 'internal' => false, '_builtin' => true ) ), which is WordPress's built-in statuses only. Any step in a custom status is missing from the loaded objects, soget_lessons()andget_topics()drop it.Fix
A new mu-plugin,
cbf-learndash-workflow-statuses.php, uses thelearndash_course_steps_post_status_keysfilter to add the pre-publication workflow statuses: those withmoderationset and withoutfor_revision. That leaves out revision statuses, which belong to separate revision posts, and other plugins' statuses such as spam.Visibility is unchanged.
LDLMS_Model_Course::can_user_read_step()still drops unpublished steps for any viewer withoutread_poston them, just as it does for drafts.Testing
I ran the filter on production in a
wp evalthat saved nothing:phpcspasses.