<?php $course_id = learn_press_get_course_by_quiz(get_the_ID()); $passed = learn_press_user_has_passed_course($course_id); $result = learn_press_get_quiz_result(); ?> <div class="clearfix"></div> <?php if ($passed) { ?> <?php learn_press_message(sprintf(__('You have passed this course with %.2f%% of total', 'learn_press'), $result['mark_percent'] * 100)); } else { ?> <?php $passing_condition = learn_press_get_course_passing_condition($course_id); ?> <?php learn_press_message(sprintf(__('Sorry, you have not passed this course. This course required you pass %.2f%% but your result is only %.2f%%', 'learn_press'), $passing_condition, $result['mark_percent'] * 100), 'error'); }
/** * Show the message let user know that they can finish the course if they want */ function learn_press_passed_conditional() { if (learn_press_user_has_passed_conditional() && !learn_press_user_has_finished_course()) { $passing_condition = learn_press_get_course_passing_condition(); learn_press_message(sprintf(__('You have passed %d percent of course and now you can finish this course if you want', 'learn_press'), $passing_condition)); } }