Batch sidebar display style not working with modern theme [Not required since version 2.6]

Please add the bellow code in your functions.php file of modern theme:

//Batches in sidebar fix for modern theme.

add_action('wplms_before_single_course','custom_batch_sidebar_fix_modern');
function custom_batch_sidebar_fix_modern(){
if(class_exists('Wplms_Batches_Init')){
global $post;
if($post->post_type == 'course'){
$course_id = $post->ID;
$display_style = get_post_meta($course_id,'vibe_batch_display',true);
if( $display_style == 'sidebar'){
$batches = Wplms_Batches_Init::init();
$batches->batches = wplms_get_course_batches($course_id);
if(empty($batches))
return;

$batches->show_enroll_button = 0;
$batches->add_enroll_now_class = 0;

//Check LMS Setting status.

if(class_exists('WPLMS_tips')){
$tips = WPLMS_tips::init();
if(isset($tips) && isset($tips->settings) && isset($tips->settings['enable_enroll_now_in_batch'])){
$batches->show_enroll_button = 1;
}
}
if(is_user_logged_in()){
$user_id =get_current_user_ID();
if(bp_course_is_member($course_id,$user_id)){
$batches->show_enroll_button = 1;
$batches->add_enroll_now_class = 1;
foreach($batches as $k => $batch_id){
if(wplms_batch_is_user_member( $user_id, $batch_id )){
$batches->show_enroll_button = 0;
break;
}
}
}
}
add_filter('wplms_sidebar',array($batches,'show_wplms_batches_in_sidebar'));
}
}
}
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *