i write this function and i recognize the process, but how inset to unset the unit lock IN ELSE STATEMENT ?
add_filter('wplms_course_finished', 'check_if_the_user_is_free', 10, 5);
add_filter('wplms_unit_mark_complete', 'check_if_the_user_is_free', 10, 5);
function check_if_the_user_is_free($flag, $user_id) {
//$unit_lock = vibe_get_option('nextunit_access');
//$uno = "ciao1";
//$due = "ciao2";
//$stampavera = '<a href="#" id="next_unit" data-unit="' . $units[$next] . '" class="' . $class . '">' . __('Next Unit', 'vibe') . '</a>';
$membership_ids = 4; //4 is the id of free membership level
$user_id2 = get_current_user_id();
if (!pmpro_hasmembershiplevel($membership_ids, $user_id2)) {
//return 1; // Continue with process
return 1;
} else {
// HOW I INSERT HERE TO UNSET THE LOCK UNIT AND SEE NEXT UNIT AND PREVOIUS UNIT ?????
}
return $flag;
}