Skip to content

Instantly share code, notes, and snippets.

@pavlo-bondarchuk
Created February 5, 2020 12:43
Show Gist options
  • Save pavlo-bondarchuk/1055e87e3304e26f01432d35a8366e71 to your computer and use it in GitHub Desktop.
Save pavlo-bondarchuk/1055e87e3304e26f01432d35a8366e71 to your computer and use it in GitHub Desktop.
Hide Course complete button until complete all lessons in Tutor LMS
/**
* Hide Course complete button until complete all lessons in Tutor LMS
*
*/
add_filter('tutor_course/single/complete_form', 'tutor_lms_hide_course_complete_btn');
function tutor_lms_hide_course_complete_btn($html){
$completed_lesson = tutils()->get_completed_lesson_count_by_course();
$lesson_count = tutils()->get_lesson_count_by_course();
if ($completed_lesson < $lesson_count){
return '';
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment