Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Mandatory course review not finishing course
- This topic has 9 replies, 2 voices, and was last updated 3 years, 6 months ago by szabonyelviskola.
Viewing 10 posts - 1 through 10 (of 10 total)
-
AuthorPosts
-
September 26, 2020 at 7:49 pm #314286szabonyelviskolaSpectatorI have found the following topic: https://wplms.io/support/forums/topic/mandatory-course-review-not-finishing-course/ Unfortunately, the URL of the final solution is broken. Would you provide me the link to the final good solution? And As I see it was made for child themes. How can use a solution which was worked out for child themes if I would like to use Customizer Plugin? I'm on 3.9.9 no child theme.September 28, 2020 at 4:46 am #314400DianaParticipantTry adding this code in wp-admin > plugins . editor > select wplms customizer plugin > wplms-customizer.php
add_filter('wplms_course_details_widget','custom_add_review_course_button',99,2); function custom_add_review_course_button($course_details,$course_id){ ?> <form action="<?php echo get_permalink($course_id); ?>" method="post"> <?php $user_id = get_current_user_id(); $finishbit=bp_course_get_user_course_status($user_id,$course_id); if(is_numeric($finishbit)){ if($finishbit < 4){ echo '<input type="submit" name="review_course" class="review_course unit_button full button" value="'. __(‘REVIEW COURSE ','vibe').'" />'; } } wp_nonce_field($course_id,'review'); ?> </form> <?php return $course_details; }
September 28, 2020 at 5:17 pm #314619szabonyelviskolaSpectatorinstalling this I got a fatal error at plugin activation for the echo '<input type="submit" name="review_course" class="review_course unit_button full button" value="'. __(‘REVIEW COURSE ','vibe').'" />; line... some syntactical problems should be there...September 28, 2020 at 9:45 pm #314668szabonyelviskolaSpectatorI have found the problem! The first apostrophe before the REVIEW was the wrong type. Changing it to normal type, no fatal error. I will check the functionality morning, now is already too late.September 29, 2020 at 5:44 am #314710DianaParticipantOkay, do let me knowSeptember 29, 2020 at 7:39 pm #314964szabonyelviskolaSpectatorI have tested it but this is not doing what I was waiting for. I would use the solution based on that snippet: add_filter('bp_get_course_check_course_complete_stop',function($flag,$course_id,$user_id){ //Check for unit completion $course_curriculum=bp_course_get_curriculum_units($id); if(isset($course_curriculum) && count($course_curriculum)){ $flag =0; foreach($course_curriculum as $unit_id){ //if(is_numeric($unit_id)){ $unittaken = bp_course_check_unit_complete($unit_id,$user_id,$id); if(empty($unittaken) && bp_course_get_post_type($unit_id) == 'quiz'){ $unittaken=get_user_meta($user_id,$unit_id,true); } if(!isset($unittaken) || !$unittaken){ $flag=$unit_id; break; } //} } $flag = apply_filters('wplms_finish_course_check',$flag,$course_curriculum); if($flag){
} $args = array( 'user_id' => $user_id, 'number' => 1, // how many comments to retrieve 'post_id' =>$course_id ); $comments = get_comments( $args ); if(!$comments){ echo ' Post a review to finish the course ! '; ?> <?php return 1; } return $flag; },10,3); But changed it to do following way: It should be: (1) Click Finish Course (2) Write a course review (3) post course review (4) System marks course as finished (5) Redirect to course finished page (which says: you finished the course and got a certificate, basically the one you see now with this snippet). And it was already done Logan and sent the link: https://gist.github.com/99madhvendra/0f9b12d631fd5440d84a33fb55beb2ca which is broken... I would need this solution behind the broken link.$type=bp_course_get_post_type($flag); switch($type){ case 'unit': $type= __('UNIT','vibe'); break; case 'assignment': $type= __('ASSIGNMENT','vibe'); break; case 'quiz': $type= __('QUIZ','vibe'); break; }//Default for other customized options $message = __('PLEASE COMPLETE THE ','vibe').$type.' : '.get_the_title($flag); echo ''.apply_filters('wplms_unfinished_unit_quiz_message',$message,$flag).''; return 1; }
September 30, 2020 at 11:24 am #315130DianaParticipantbasically, you are asking that until and unless review I posted, the course should not be marked as completed The code changed a bit when @logan created this gist so I need to check the code This is the code which needs modification: https://wplms.io/support/knowledge-base/mandatory-course-review-before-course-finish/ Please give me a day so that I can share the updated oneSeptember 30, 2020 at 1:20 pm #315166szabonyelviskolaSpectatorYes, this is the code which was rewritten by @Logan for the process in 1-2-3-4-5 steps. Ok, take your time.October 8, 2020 at 3:06 pm #316994szabonyelviskolaSpectatorAny news...?October 15, 2020 at 5:36 pm #318629szabonyelviskolaSpectatorDid you find the updated code? -
AuthorPosts
Viewing 10 posts - 1 through 10 (of 10 total)
- The topic ‘Mandatory course review not finishing course’ is closed to new replies.