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

Allow lesson access based on enrollment drip setting with Course Start Date set #2844

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
significance: patch
type: changed
links:
- "#2843"
entry: Allow lesson access based on enrollment drip setting with Course Start
Date set.
23 changes: 17 additions & 6 deletions includes/functions/llms.functions.access.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,24 @@ function llms_page_restricted( $post_id, $user_id = null ) {

$course_id = llms_is_post_restricted_by_time_period( $post_id, $user_id );
if ( $course_id ) {
$lesson = new LLMS_Lesson( $post_id );

$lesson_id = llms_is_post_restricted_by_drip_settings( $post_id, $user_id );
if ( $lesson_id && 'enrollment' === $lesson->get( 'drip_method' ) ) {
$results['is_restricted'] = true;
$results['reason'] = 'lesson_drip';
$results['restriction_id'] = $lesson_id;
/* This filter is documented above. */
return apply_filters( 'llms_page_restricted', $results, $post_id );
}

$results['is_restricted'] = true;
$results['reason'] = 'course_time_period';
$results['restriction_id'] = $course_id;
/* This filter is documented above. */
return apply_filters( 'llms_page_restricted', $results, $post_id );

if ( ! $lesson_id && 'enrollment' !== $lesson->get( 'drip_method' ) ) {
$results['is_restricted'] = true;
$results['reason'] = 'course_time_period';
$results['restriction_id'] = $course_id;
/* This filter is documented above. */
return apply_filters( 'llms_page_restricted', $results, $post_id );
}
}

$prereq_data = llms_is_post_restricted_by_prerequisite( $post_id, $user_id );
Expand Down
Loading