Remove admin option for instructors in course nav

Please add the given code in your wplms-cusomizer.php file wplms customizer plugin :

add_action('wp_footer','course_nav_drive');
function course_nav_drive($menu){
    if(!current_user_can('manage_options')){
     echo '<style>.single-course li#admin {
    display: none !important;
}</style>';
    }
    return $menu;
  }
add_action('bp_template_redirect','course_nav_drive_access',99);
function course_nav_drive_access(){
    
    if(!is_singular('course'))
      return;

    global $bp;   
    $permalinks = Vibe_CustomTypes_Permalinks::init();
    
    if($_GET['action'] == 'admin' || bp_current_action() == 'admin' || $bp->unfiltered_uri[2] == 'admin' || (!empty($permalinks->permalinks['admin_slug']) && $bp->unfiltered_uri[2] == trim($permalinks->permalinks['admin_slug'],'/'))) {
      if(!current_user_can('manage_options')){
        global $post;
        wp_redirect(get_permalink($post->ID));
        exit;
      }
    }
  }

 

Leave a Reply

Your email address will not be published. Required fields are marked *