free unit – user registration

Home Forums Legacy Support Support queries How-to & Troubleshooting free unit – user registration

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #356162
    plxmas
    Participant
    I made a free unit in my course. I want that this unit is free for logged in user. I flagged Disable free unit access for the world, only logged in users can view free units. in WPLMS->settings I'd like the unit is clickable and then the user goes on login/registration page before he play the unit.
    #356235
    Veronica
    Moderator
    hi if you want then you can check this https://wplms.io/support/forums/topic/tip-open-login-popup-when-user-try-to-see-free-units/
    #356236
    plxmas
    Participant
    thanks. I'll try. can you add an option un future wplms release? I'm not power user and sometime I've difficult to code
    #356244
    plxmas
    Participant
    I've used the code in your reply. now I've a complete different site. and a issue with course layout. Screenshot-2021-05-06-at-10-19-02 before Screenshot-2021-05-06-at-10-19-20 after Screenshot-2021-05-06-at-10-23-20 course page this is a disaster!
    #356432
    Ada
    Participant
    Hi, First Please confirm are you using wplms 4 or wplms3. As this tip will not work on wplms4.
    #356533
    plxmas
    Participant
    yes, I use version 4
    #356621
    Ada
    Participant
    Hi, For wplms 4, please add this code in wplms customizer.php
    
    add_filter('wplms_curriculum_course_lesson','wplms_free_access_2',99,3);
    function wplms_free_access_2($html,$lesson,$course_id){
    $free=get_post_meta($lesson,'vibe_free',true);
    if(!is_user_logged_in() && vibe_validate($free)){
    
    return '<a class="login_trig" href="#login">'.get_the_title($lesson).'</a>';
    }else{
    return $html;
    }
    }
    
    and Add this code in wplms>>footer>>google analytics code
    
    <script>
    jQuery("document").ready(function($){
    $(".login_trig").on('click',function(event){
    event.preventDefault();
    $('a.vibebp-login span').trigger('click');
    });
    });
    </script>
    
    If it does not work on your site. then please provide your site URL with admin credentials in private reply. I will check on your site. As this code is working on my setup.
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘free unit – user registration’ is closed to new replies.