Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add_filter('wplms_direct_access_tounit','enable_access_tostudents',999,2);
function enable_access_tostudents($flag,$post){
if(!empty($_GET) && !empty($_GET['access_token'])){
$token = urldecode ($_GET['access_token']);
$course_id = $_GET['id'];
global $wpdb;
$user_id = $wpdb->get_var("SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = '$token'");
if(!empty($user_id) && is_numeric($user_id)){
$check = wplms_user_course_active_check($user_id,$course_id);
if($check){
return 0;
}
}
}
return $flag;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment