Mandatory course review not finishing course

Home Forums Legacy Support Support queries How-to & Troubleshooting Mandatory course review not finishing course

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #314286
    szabonyelviskola
    Spectator
    I 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.
    #314400
    Diana
    Participant
    Try 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;
    
    }
    
    
    #314619
    szabonyelviskola
    Spectator
    installing 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...
    #314668
    szabonyelviskola
    Spectator
    I 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.
    #314710
    Diana
    Participant
    Okay, do let me know
    #314964
    szabonyelviskola
    Spectator
    I 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){
    $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;
    
    }
    
    } $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.
    #315130
    Diana
    Participant
    basically, 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 one
    #315166
    szabonyelviskola
    Spectator
    Yes, this is the code which was rewritten by @Logan for the process in 1-2-3-4-5 steps. Ok, take your time.
    #316994
    szabonyelviskola
    Spectator
    Any news...?
    #318629
    szabonyelviskola
    Spectator
    Did you find the updated code?
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Mandatory course review not finishing course’ is closed to new replies.