Take this course on sidebar

Home Forums Legacy Support Support queries Other issues Take this course on sidebar

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #180446
    Julien3z
    Participant
    Hi, I need to make a different redirection on the "Take this course" button on a course page. I explain myself. 1. User is not logged in. When he is on this page https://adekoite-dev.fr/appli/diplome/manager-unite-operationnelle/  he clicks on the button "Take this course" (translated into "Accéder à cette formation" in french). By clicking on this button he's redirected on the custom registration page which is correct. 2. The user has proceed the step 1 just mentionned above and is registered and redirected to this page https://adekoite-dev.fr/appli/formulaire-dacceptation/ to choose his course and access another step before payment. The issue is : if he goes back to homepage or goes out of this page to check for example on this course page : https://adekoite-dev.fr/appli/diplome/manager-unite-operationnelle/  then we he clicks on "Take this course" button he is again redirected to the custom registration form, instead of this page : https://adekoite-dev.fr/appli/formulaire-dacceptation/ So, I've created another sidebar as shown here https://wplms.io/support/knowledge-base/show-different-sidebars-based-on-user-login-status/ but that doesn't work (blank page)   Can you please help ? Thanks
    #180447
    Julien3z
    Participant
    This reply has been marked as private.
    #180605
    Anshuman Sahu
    Keymaster
    ok I added the code please check if its working for you or not .
    #180613
    Julien3z
    Participant
    Hi, I've checked but I don't see any changes...after registering the button still redirects to the registration page..
    #180782
    Anshuman Sahu
    Keymaster
    Well I have added the code mentioned in this tip successfully in your site . didnt You wanted to show another sidebar for logged users ?
    #180940
    Julien3z
    Participant
    Like I said it's the button "Take this course" for which I need to change it's redirection whether the user is connected or not. This button is not a widget, so having 2 different sidebars don't change anything I guess.. What code have you added please, because if you test it you'll see no  changes and still redirects to resgister form even if user is already registered.
    #181184
    Anshuman Sahu
    Keymaster
    well then you wish to change the url on take this course button . then please remove all the code from that tip and then add this one :       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 ='';         $page = 'http://for-non-logged-in-user.com';     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>';    }   if(is_user_logged_in()){     $extra ='';        $page = 'http://for-logged-in-user.com';     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; }     change " http://for-logged-in-user.com " and " http://for-non-logged-in-user.com " as you requirements .
    #181532
    Julien3z
    Participant
    Thanks but if I add this code below in wplms-customizer.php, website is broken with a blank page...   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 ='';           $page = 'https://adekoite-dev.fr/appli/inscription/';       return ''.apply_filters('wplms_take_this_course_button_label',__('TAKE THIS COURSE','vibe'),$course_id).apply_filters('wplms_course_button_extra',$extra,$course_id).'';      }     if(is_user_logged_in()){       $extra ='';          $page = 'https://adekoite-dev.fr/appli/formulaire-dacceptation/';       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;   }
    #181839
    Anshuman Sahu
    Keymaster
    #181841
    Anshuman Sahu
    Keymaster
    dont forget to remove the old code .
    #182098
    Julien3z
    Participant
    That is still not working, there's absolutely no changes. After login, the button "Take this course" always redirects to the register form instead of my custom page : https://adekoite-dev.fr/appli/formulaire-dacceptation/ Have you tested this code ???
    #182383
    Anshuman Sahu
    Keymaster
    Yes I have testes but not with all cases and scenarios .wplms has many settings . It might be conflicting . update the code on this gist .it should work now : https://gist.github.com/alexvibealex/c5910a99cd80f92c24d954e50564c1cc   remove old one and add this one .
    #182404
    Julien3z
    Participant
    Yes, that works fine now Thank you very much
Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Take this course on sidebar’ is closed to new replies.