Using JWPlayer with WPLMS

To make JWPlayer compatible with WPLMS, that is to open the JWPlayer videos in units when students are pursuing the course, you can follow below settings

Copy and paste the code (from any one of the methods) in WPLMS Customizer/wplms_customizer.php file or WPLMS Child theme (any)/functions.php file

Below are 2 methods for making JWPlayer compatible with WPLMS :

Method 1 

add_action('wplms_before_every_unit','wplms_jwplayer_compatibility');
 
function wplms_jwplayer_compatibility(){
 add_shortcode('jwplayer', array('JWP6_Plugin', 'shortcode'));
}

Method 2

add_action('plugins_loaded','wplms_define_function_the_unit');
function wplms_define_function_the_unit(){
 
if(!function_exists('the_unit')){
  function the_unit($id=NULL){
    if(!isset($id))
      return;
     
    do_action('wplms_before_every_unit',$id);
    do_action('wp_enqueue_scripts');
    $post_type = get_post_type($id);
    $the_query = new WP_Query( 'post_type='.$post_type.'&p='.$id );
    $user_id = get_current_user_id();
 
    while ( $the_query->have_posts() ):$the_query->the_post();
     
    $unit_class = 'unit_class';
    $unit_class=apply_filters('wplms_unit_classes',$unit_class,$id);
    echo '<div class="main_unit_content '.$unit_class.'">';
   add_shortcode('jwplayer', array('JWP6_Plugin', 'shortcode'));
    if($post_type == 'quiz'){
      $expiry = get_user_meta($user_id,$id,true);
      if(is_numeric($expiry) && $expiry < time()){
        $message = get_post_meta($id,'vibe_quiz_message',true);
        echo apply_filters('the_content',$message);
      }else{
        the_content(); 
      }
    }else{
       the_content(); 
    }
     
    wp_link_pages(array(
      'before'=>'<div class="unit-page-links page-links"><div class="page-link">',
      'link_before' => '<span>',
      'link_after'=>'</span>',
      'after'=> '</div></div>'));
 
    echo '</div>';
    endwhile;
    wp_reset_postdata();
 
    do_action('wplms_after_every_unit',$id);
 
    $attachments =& get_children( 'post_type=attachment&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$id);
    if($attachments && count($attachments)){
      $att= '';
 
      $count=0;
    foreach( $attachments as $attachmentsID => $attachmentsPost ){
     
    $type=get_post_mime_type($attachmentsID);
 
    if($type != 'image/jpeg' && $type != 'image/png' && $type != 'image/gif'){
         
        if($type == 'application/zip')
          $type='icon-compressed-zip-file';
        else if($type == 'video/mpeg' || $type== 'video/mp4' || $type== 'video/quicktime')
          $type='icon-movie-play-file-1';
        else if($type == 'text/csv' || $type== 'text/plain' || $type== 'text/xml')
          $type='icon-document-file-1';
        else if($type == 'audio/mp3' || $type== 'audio/ogg' || $type== 'audio/wmv')
          $type='icon-music-file-1';
        else if($type == 'application/pdf')
          $type='icon-text-document';
        else
          $type='icon-file';
 
        $count++;
 
        $att .='<li><i class="'.$type.'"></i>'.wp_get_attachment_link($attachmentsID).'</li>';
      }
    }
      if($count){
        echo '<div class="unitattachments"><h4>'.__('Attachments','vibe').'<span><i class="icon-download-3"></i>'.$count.'</span></h4><ul id="attachments">';
        echo $att;
       echo '</ul></div>';
      }
    }
 
    $forum=get_post_meta($id,'vibe_forum',true);
    if(isset($forum) && $forum){
      echo '<div class="unitforum"><a href="'.get_permalink($forum).'" target="_blank">'.__('Have Questions ? Ask in the Unit Forums','vibe').'</a></div>';
    }
  }
}
 
}