Created
          June 24, 2020 03:50 
        
      - 
      
- 
        Save MrVibe/b83807895e36aeaa6a3a4ccb25606b46 to your computer and use it in GitHub Desktop. 
    Remove Expired course status when user did not start the course and Enable course status from course start.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | add_filter('wplms_expired_course_button',function($button,$course_id){ | |
| if(is_user_logged_in()){ | |
| $user_id = get_current_user_id(); | |
| $course_status = bp_course_get_user_course_status($user_id,$course_id); | |
| if($course_status == 0){ //USer subscribed but not started | |
| $init=WPLMS_tips::init(); | |
| if(!empty($init->lms_settings['calculate_course_duration_from_start_course'])){ | |
| $expiry = bp_course_get_user_expiry_time($user_id,$course_id); | |
| if($expiry < time(){ | |
| bp_course_update_user_expiry_time($user_id,$course_id,$new_time); | |
| return '<a href="'.get_permalink($course_id).'" class="course_button button full">'.__('Start Course','vibe').'</a>'; | |
| } | |
| } | |
| } | |
| } | |
| return $button; | |
| },10,2); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment