Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Login popup for Free courses only
- This topic has 10 replies, 3 voices, and was last updated 7 years ago by daammon.
Viewing 11 posts - 1 through 11 (of 11 total)
-
AuthorPosts
-
May 5, 2017 at 7:32 am #110620chessbeeSpectatorI need to have a login popup to appear when people click on 'Take this course' button only for Free courses (only for non-logged in users). But for paid courses, they should be redirected to Cart as usual. I tried this but not working. Note: I already use the below code in Child theme function.php, let me know if I should remove this before trying anything else. 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://chessbee.com/register/'; 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; } ?>May 5, 2017 at 11:41 am #110659H.K. LatiyanParticipantHi.. You can remove this code and then add the code I shared in the topic you shared above. That code will work fine and will open the login popup on free courses only.October 30, 2017 at 5:24 pm #134150daammonSpectatorHi, I am having the same problem. I added the code of that link and it is not working. https://wplms.io/support/forums/topic/apply-popup-directly-to-take-this-course-button-for-nonlogged-in-free-course/ Additionally, that code is removing the menu button in the cellphone. Any clue what is happening and how can I solve it? Thanks, DanielOctober 31, 2017 at 7:53 am #134198H.K. LatiyanParticipantHi, @daammon: Please create your own topics for your issues. ------------ The code is correct if you are using the default wplms theme, but if you are using the modern theme then it will not work. However for this we have also added a setting now in lms->settings. Please enable the setting open login popup for non logged in users when clicked on take this course button.October 31, 2017 at 1:12 pm #134283daammonSpectatorHi Latiyan, Sorry, I though It would be better for you reusing previous related topics. I will create them from now on. If I click that setting, (LMS/settings) the pop up appears for free and non-free courses. I want the pop up to appear only in the free courses. How can I do that? Thanks! DanielNovember 1, 2017 at 6:24 am #134343H.K. LatiyanParticipant@daammon: Are you using modern theme ? If no then the code shared in that topic will work fine, but if you are using modern theme then remove the previous code and use the below code: add_action('wp_footer','trigger_login_popup_course_error'); function trigger_login_popup_course_error(){ global $post; if($post->post_type != 'course' || is_user_logged_in()) return; $free = get_post_meta($post->ID,'vibe_course_free',true); if(function_exists('vibe_validate') && vibe_validate($free)){ ?><script> jQuery("document").ready(function($){ $(".button.course_button").on('click',function(event){ event.preventDefault(); $('#login_modern_trigger').trigger('click'); }); }); </script>'; <?php } }November 1, 2017 at 7:11 pm #134465daammonSpectatorHi! I bought the theme 3-4 months ago so I guess it is the modern theme. You can check it in my site www.tu-plaza.com I tried the code you sent me, with the LMS/setting for the Pop up ON and OFF, and it didn't work. LMS/Setting for the Pop up ON: The pop up shows always. It doesn't matter if the course is free or not. LMS/Setting for the Pop up OFF: The pop up never shows. Right now, I have the setting set in OFF mode as I don't want to lose sales because the customers get distracted with the pop up. Additionally, if the pop up is ON, after finishing the register, it redirects the customers to the "home page" and not to the page where they were on that moment. So they get totally lost. Could you, please, help me? Thanks, DanielNovember 2, 2017 at 11:12 am #134511H.K. LatiyanParticipantHi, You are using the default wplms theme and the code for this is already correct and the below code should work fine: add_action('wp_footer','trigger_login_popup_course_error'); function trigger_login_popup_course_error(){ global $post; if( $post->post_type != 'course' || !is_singular('course') || is_user_logged_in() ){ return; } $free = get_post_meta($post->ID,'vibe_course_free',true); if(function_exists('vibe_validate') && vibe_validate($free)){ ?><script> jQuery("document").ready(function($){ $(".button.course_button").on('click',function(event){ event.preventDefault(); $('.smallimg.vbplogin').trigger('click'); }); }); </script>'; <?php } }November 2, 2017 at 11:52 am #134521daammonSpectatorThis reply has been marked as private.November 2, 2017 at 12:09 pm #134529H.K. LatiyanParticipantHi, You do not have to add the code in custom css. This is a php code not a css code. Please remove the code from custom css. ------------ The php code has to be added in wplms-customizer.php file present in wp-admin->plugins->editor->select wplms customizer plugin->wplms-customizer.php file:November 2, 2017 at 12:27 pm #134533daammonSpectatorHi Latiyan, I am sorry I misunderstood it. Now it is working. Thank you very much, Daniel
-
AuthorPosts
Viewing 11 posts - 1 through 11 (of 11 total)
- The topic ‘Login popup for Free courses only’ is closed to new replies.