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):

NOTE: Please change the url “http://vibethemes.com” to your register page url

Was this article helpful?

Related Articles

9 Comments

  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:

    add_filter(‘wplms_take_course_button_html’,’custom_non_loggedin_user_redirect’,10,2);
    add_filter(‘wplms_course_non_loggedin_user’,’custom_non_loggedin_user_redirect’,10,2);
    add_filter(‘wplms_private_course_button_html’,’custom_non_loggedin_user_redirect’,10,2);

    function custom_non_loggedin_user_redirect($html,$course_id){
    if(!is_user_logged_in()){
    $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?