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

Check sensei_user_can_register_for_course filter when My Courses Page is not set #2865

Merged
merged 2 commits into from Jan 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions includes/class-sensei-course.php
Expand Up @@ -3086,18 +3086,17 @@ public static function output_course_enrolment_actions() {

}

if ( ! (bool) apply_filters( 'sensei_user_can_register_for_course', true, $post->ID ) ) {
return;
}
// If a My Courses page was set in Settings, and 'sensei_use_wp_register_link'
// is false, link to My Courses. If not, link to default WordPress registration page.
if ( ! empty( $my_courses_page_id ) && $my_courses_page_id && ! $wp_register_link ) {
if ( true === (bool) apply_filters( 'sensei_user_can_register_for_course', true, $post->ID ) ) {
$my_courses_url = get_permalink( $my_courses_page_id );
echo '<div class="status register"><a href="' . esc_url( $my_courses_url ) . '">' .
esc_html__( 'Register', 'sensei-lms' ) . '</a></div>';
}
} else {

wp_register( '<div class="status register">', '</div>' );

wp_register( '<div class="status register">', '</div>' );
}
}
}
Expand Down