Redirect Non-logged in Users to Register Page when they click on Take this course button

Please add this code in your wplms-customizer.php file present in your wplms customizer plugin (go to wp-admin->plugins->editor->select wplms customizer plugin and add the code in wplm-customizer.php file) OR add the code in the function.php file of your child theme (if using a child theme):


function custom_non_loggedin_user_redirect($html,$course_id){
    $extra ='';    
    $page = '';
    return '<a href="'.$page.'" 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;

NOTE: Please change the url “” to your register page url

Was this article helpful?

Related Articles


  1. fuadmurad

    Hi, I know it’s been some time since this was posted but I tried this code and it did not work. Any ideas why?

  2. terracotta

    I managed to do a popup using the above code as base.
    First, create a popup class using popop maker plugin.

    Use this course in the wplms-customizer.php, where “XXX” is the popup maker ID:


    function custom_non_loggedin_user_redirect($html,$course_id){
    $extra =”;
    return ‘ ‘.apply_filters(‘wplms_take_this_course_button_label’,__(‘TAKE THIS COURSE’,’vibe’),$course_id).apply_filters(‘wplms_course_button_extra’,$extra,$course_id).’‘;
    return $html;

  3. unlocksolutions

    When i try adding this code i get this error

    ‘ Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP. ‘

    What can i do?

Leave A Comment?