Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Created April 8, 2021 09:52
Show Gist options
  • Save MrVibe/6f2c94886a2e1d9b9b790021444e634b to your computer and use it in GitHub Desktop.
Save MrVibe/6f2c94886a2e1d9b9b790021444e634b to your computer and use it in GitHub Desktop.
Restrict Unit types per member
add_filter('wplms_course_creation_tabs',function($tabs,$user_id){
//USER_ID , get Instructor Type
if(CONDITION FOR INSTRUCTOR MEMBER TYPE DETECTION) {
$unit_types = $tabs['course_curriculum']['fields'][0]['curriculum_elements'][1]['types'];
foreach($unit_types as $k=>$type){
if($type['id'] == 'video'){ //Match Unit Type
unset($unit_types[$k]); // Unset for Instructor
}
}
$tabs['course_curriculum']['fields'][0]['curriculum_elements'][1]['types'] = $unit_types;
}
return $tabs;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment