Home › Forums › Legacy Support › Support queries › Other issues › Take this course on sidebar
- This topic has 12 replies, 2 voices, and was last updated 5 years, 6 months ago by Julien3z.
Viewing 13 posts - 1 through 13 (of 13 total)
-
AuthorPosts
-
October 17, 2018 at 2:38 pm #180446Julien3zParticipantHi, 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 ? ThanksOctober 17, 2018 at 2:40 pm #180447Julien3zParticipantThis reply has been marked as private.October 18, 2018 at 2:12 pm #180605Anshuman SahuKeymasterok I added the code please check if its working for you or not .October 18, 2018 at 2:35 pm #180613Julien3zParticipantHi, I've checked but I don't see any changes...after registering the button still redirects to the registration page..October 20, 2018 at 12:51 pm #180782Anshuman SahuKeymasterWell I have added the code mentioned in this tip successfully in your site . didnt You wanted to show another sidebar for logged users ?October 22, 2018 at 8:40 am #180940Julien3zParticipantLike 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.October 23, 2018 at 2:47 pm #181184Anshuman SahuKeymasterwell 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 .October 25, 2018 at 7:49 am #181532Julien3zParticipantThanks 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; }October 26, 2018 at 1:57 pm #181839Anshuman SahuKeymasterplease add the code form this link : https://gist.github.com/alexvibealex/c5910a99cd80f92c24d954e50564c1ccOctober 26, 2018 at 1:58 pm #181841Anshuman SahuKeymasterdont forget to remove the old code .October 29, 2018 at 9:32 am #182098Julien3zParticipantThat 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 ???October 30, 2018 at 2:51 pm #182383Anshuman SahuKeymasterYes 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 .October 30, 2018 at 3:45 pm #182404Julien3zParticipantYes, that works fine now Thank you very much
-
AuthorPosts
Viewing 13 posts - 1 through 13 (of 13 total)
- The topic ‘Take this course on sidebar’ is closed to new replies.