Login popup on Free Course

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

add_action('wp_footer','trigger_login_popup_course_error');
function trigger_login_popup_course_error(){
  if(!is_singular('course') || is_user_logged_in())
    return;

  $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  if(strpos($actual_link,'error') && strpos($actual_link, 'login')){
  ?><script>
  jQuery("document").ready(function($){
    $("#message a").on('click',function(event){
      event.preventDefault();
      $('#login_modern_trigger').trigger('click');
    });
  });
  </script>';
  <?php
  }
}

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

add_action('wp_footer','trigger_login_popup_course_error');
function trigger_login_popup_course_error(){
  if(!is_singular('course') || is_user_logged_in())
    return;
 
  $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  if(strpos($actual_link,'error') && strpos($actual_link, 'login')){
  ?><script>
  jQuery("document").ready(function($){
    $("#message a").on('click',function(event){
      event.preventDefault();
      $('.smallimg.vbplogin').trigger('click');
    });
  });
  </script>';
  <?php
  }
}

 

 

Was this article helpful?

4 Comments

  1. monsieuremmanuel

    Hello!

    What do you mean by “open login popup on login error” ?
    When someone login on my website (pepperfrench.com) with a wrong password or id, it goes to wp-login.php… is there a way to force to stay in the login form of modern theme after an error?
    I tried your code but it crashed my website…

  2. JWhacheng

    This code changed complete what I was working…Where does this code go to eliminate it?

  3. ap_kubeka

    Hi. This is the second login script I’ve used in order to get a login/sign up pop screen, and every time I run them, they completely change my theme. How do I avoid that? I just want to use the same AJAX login/registration form when a user tries to apply for a course without being logged in.

Leave A Comment?