Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Coming Soon button on free courses subscribes user to course
- This topic has 8 replies, 2 voices, and was last updated 6 years, 2 months ago by H.K. Latiyan.
Viewing 9 posts - 1 through 9 (of 9 total)
-
AuthorPosts
-
March 1, 2018 at 12:27 am #148323italymadeeasySpectatorWe have some free courses which are not complete on our site, we have enabled the option for "Coming Soon". Unfortunately this button is clickable and rather than rejecting the user to join the course, it just adds them into it and they see an incomplete/empty and very confusing course. https://cl.ly/3J2j28091x0j https://cl.ly/0L1y1u1q2U1XMarch 1, 2018 at 9:29 am #148382H.K. LatiyanParticipantHi, I was unable to replicate this issue on my test setup, but was able to replicate this on your website. I checked that on your website the url is generating however by default in the coming soon mode no url is generated on the button. This could be because of a custom code, maybe we have given a custom code adding the url for the button or some other code. Can you please check if you have ever added any code for coming soon button.March 6, 2018 at 6:28 am #148969italymadeeasySpectatorI looked around but couldn't find any code for the coming soon button, I also checked the option in the database for one of the affected courses, the "vibe_coming_soon" postmeta was set to "S" which by looking through the code, this should mean the wplms_coming_soon_link link results to returning '#' which shouldn't add the user to the course. I'm presuming you're connected to our development server when you're testing (has the same issue on production). you will find our custom code in the "Snippets" tool, we do not use the WPLMS Customization plugin.March 6, 2018 at 6:38 am #148971italymadeeasySpectatorThis reply has been marked as private.March 6, 2018 at 7:19 am #148983italymadeeasySpectatorI think I found the issue. Digging through the code, I found the following in plugins/vibe-customtypes/includes/tips.php " function manual_subscription($link,$course_id){ $free = get_post_meta($course_id,'vibe_course_free',true); if(vibe_validate($free)){ $link = get_permalink($course_id).'?subscribe'; } return $link; } " This pretty much looks at the setting of vibe_course_free and returns the permalink plus the ?subscribe tag that will subscribe the user to the course. in the massive case statement you have, one of the keys is "disable_autofree" which adds the filter of manual_subscription. The situation we have right now is. We have Auto Free Courses disabled because we don't want all new subscribers to be given all the free courses. We have free courses which are not completed yet, hence, coming soon. I believe in order to fix the bug, you have to add a condition to manual_subscription to check if the course is "coming soon" or not, before the return of permalinks . ?subscribeMarch 6, 2018 at 10:02 am #148999H.K. LatiyanParticipantHi, Please change this function as below: function manual_subscription($link,$course_id){ $free = get_post_meta($course_id,'vibe_course_free',true); if(vibe_validate($free)){ $coming_soon = get_post_meta($course_id,'vibe_coming_soon',true); if(!vibe_validate($coming_soon)){ $link = get_permalink($course_id).'?subscribe'; } } return $link; }March 9, 2018 at 4:01 am #149426italymadeeasySpectatorI can directly change the code easily, but am wondering if you are including this code in your next update for the plugin, so when I next update my plugins, it isn't overwritten and the problem doesn't come backMarch 9, 2018 at 4:42 am #149432italymadeeasySpectatorI learnt how to code the change in through a snippet, I removed the filter that existed and added my own to solve the issue. this is for anyone else who has the issue.
add_action( 'woocommerce_init', 'ime_change_tips_course_button_filter' ); function ime_change_tips_course_button_filter() { global $tips; remove_filter ('wplms_private_course_button', array($tips,'manual_subscription'),10); add_filter ('wplms_private_course_button', array($tips,'ime_manual_subscription'),10,2); } function ime_manual_subscription ($link,$course_id){ $free = get_post_meta($course_id,'vibe_course_free',true); if(vibe_validate($free)){ $coming_soon = get_post_meta($course_id,'vibe_coming_soon',true); if(!vibe_validate($coming_soon)){ $link = get_permalink($course_id).'?subscribe'; } } return $link; }
March 9, 2018 at 4:55 am #149436H.K. LatiyanParticipantHi, Yes, this is the way to make changes in the code if the code is not updated. But we are making this change in the next update of vibe custom types plugin also, so your changes will not be lost with the next update. Therefore you do not need to remove the filter and add your custom function on it. -
AuthorPosts
Viewing 9 posts - 1 through 9 (of 9 total)
- The topic ‘Coming Soon button on free courses subscribes user to course’ is closed to new replies.