https://wplms.io/support/knowledge-base/open-login-popup-on-free-course-login-error/
i want to modify this and apply the popup action directly when user clicks on take this course button instead of clicking the
"You must be logged in to take this course → LOGIN | REGISTER NOW"
You can try adding the bellow code instead:
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();
$('.smallimg.vbplogin').trigger('click');
});
});
</script>';
<?php
}
}
Thanks for confirming, so closing the topic.