free course take this course button issue in modern theme(fix)

Please add the given code in your wplms-customizer.php file in your wplms customizer plugin :

add_action(‘template_redirect’,’subscribe_free_course_fix_modern’,999);

function subscribe_free_course_fix_modern(){
    global $post;
    if(!is_singular(‘course’))
        return;
    if(isset($_GET[‘subscribe’])){
        $free = get_post_meta($post->ID,’vibe_course_free’,true);
        if(vibe_validate($free)){
            $user_id = get_current_user_id();
            bp_course_add_user_to_course($user_id,$post->ID);
        }
    }
}

Was this article helpful?

Leave A Comment?