WordPress LMS for Web and mobile › Forums › Ionic App Support › Make the user login in browser when he login in app › Reply To: Make the user login in browser when he login in app
December 20, 2019 at 12:47 pm
#41308

Scott Lang
Keymaster
If the videos are accessible publicly thus they will access within the unit.
Add this code to your customizer plugin this will enable direct access to unit from app in-app browser
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;
} After that go to the unit URL from app unit button click.
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;
} After that go to the unit URL from app unit button click.