Skip to content

FranciscoHV/WPLMS-Popup-Free-Unit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

WPLMS-Popup-Free-Unit

Open Popup when user try to see free units

This code works when the users try to enter to see free units.

1.-Add this code in WPLMS customizer plugin ("wplms-customizer.php")

add_filter('wplms_curriculum_course_lesson','wplms_free_access_2',99,3);
function wplms_free_access_2($html,$lesson,$course_id){
if(!is_user_logged_in()){
$free=get_post_meta($lesson,'vibe_free',true);
return '<a class="button_trig_login" href="#">'.get_the_title($lesson).(vibe_validate($free)?'<span>'.__('Gratuit','wplms_modern').'</span>':'').'</a>';
}else{
return $html;
}
}

2.-Now add this code in your wplms -> footer -> google anaylitics :

<script>
jQuery("document").ready(function($){
$(".button_trig_login").on('click',function(event){
event.preventDefault();
$('a.smallimg.vbplogin').trigger('click');
});
});
</script>

For more reference:

Credits to @thexlearner 👍

About

Open Popup when user try to see free units

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published