Show Error message for Non-logged in Users when they click on Take this course button

Please use this code in your wplms-customizer.php file in your wplms customizer plugin:

add_filter('wplms_take_course_button_html','custom_non_loggedin_user_redirect',10,2);
function custom_non_loggedin_user_redirect($html,$course_id){
  if(!is_user_logged_in()){
    $message=get_permalink().'?error=login';
    return '<a href="'.$message.'" class="course_button full button">'.apply_filters('wplms_take_this_course_button_label',__('TAKE THIS COURSE','vibe'),$course_id).apply_filters('wplms_course_button_extra',$extra,$course_id).'</a>'; 
  }
  return $html;
}

 

Was this article helpful?

Related Articles

Leave A Comment?