Coming Soon button on free courses subscribes user to course

Home Forums Legacy Support Support queries How-to & Troubleshooting Coming Soon button on free courses subscribes user to course

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #148323
    italymadeeasy
    Spectator
    We 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/0L1y1u1q2U1X
    #148382
    H.K. Latiyan
    Participant
    Hi, 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.
    #148969
    italymadeeasy
    Spectator
    I 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.
    #148971
    italymadeeasy
    Spectator
    This reply has been marked as private.
    #148983
    italymadeeasy
    Spectator
    I 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 . ?subscribe
    #148999
    H.K. Latiyan
    Participant
    Hi, 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; }
    #149426
    italymadeeasy
    Spectator
    I 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 back
    #149432
    italymadeeasy
    Spectator
    I 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;
    }
    
    #149436
    H.K. Latiyan
    Participant
    Hi, 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.
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.