Hide tabs for instructor only

Home Forums Legacy Support Support queries How-to & Troubleshooting Hide tabs for instructor only

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #373536
    Elite
    Participant
    Hi, I am using the code from this post https://wplms.io/support/forums/topic/code-help/
    add_filter('bp_course_api_get_instructor_tabs',function($tabs,$course_id,$user_id=null){
      $t = [];
      foreach($tabs as $k => $tab){
        if(!($tab['key']=='reviews' || $tab['key']=='qna')){
          $t[] = $tab;
        }
      }
    
      return $t;
    },10,3);
    in the WPLMS Customizer plugin, to hide the "Admin" and "Edit course" tabs for the instructor role only, but: 1. This is also hiding them from the admin user. https://drive.google.com/file/d/1X8pf6eMlErPrXbUJT39x2Iv1wRYEh3EY/view?usp=sharing 2. Although this has hidden the "Admin" tab, it continues displaying the content of the tab at the bottom, allowing the instructor to remove students from the course. https://drive.google.com/file/d/1lwCHi1WxCxW5Nkd7MHmWmv0yh5TKn6aO/view?usp=sharing WP version 5.8.1 WPLMS Theme Version 4.1 VibeVP Version 1.6.3
    #373578
    Veronica
    Moderator
    This reply has been marked as private.
    #373602
    Elite
    Participant
    My settings are the same https://drive.google.com/file/d/1Ej1CAq72G10Is2gAIZGt8tW8bRU7iQVA/view?usp=sharing If I put the code in the WPLMS Customizer plugin the result is the same, both the administrator user and the instructor do not see the tabs (but the content of the "Admin" tab is shown at the bottom), if I remove the code, it shows me the "Admin" and "Edit Course" tabs for both.
    #373650
    Veronica
    Moderator
    no problem we can check this on your site please provide details so we can check this at your end
    #373689
    Elite
    Participant
    This reply has been marked as private.
    #373863
    Veronica
    Moderator
    hi add this code in wplms-customizer.php
    add_filter('bp_course_api_get_instructor_tabs',function($tabs,$course_id,$user_id=null){
      $t = [];
      if(!user_can($user_id,'manage_options')){
        foreach($tabs as $k => $tab){
            if($tab['key']=='reviews' || $tab['key']=='qna'){
              
            }else{
                $t[] = $tab;
            }
          }
        }else{
        	return $tabs;
        }
      return $t;
    },10,3);
    
    #373958
    Elite
    Participant
    Thanks for response, I adjusted the code for the "Admin" and "Edit Course" tabs:
    add_filter('bp_course_api_get_instructor_tabs',function($tabs,$course_id,$user_id=null){
      $t = [];
      if(!user_can($user_id,'manage_options')){
        foreach($tabs as $k => $tab){
            if($tab['key']=='admin' || $tab['key']=='edit_course'){
              
            }else{
                $t[] = $tab;
            }
          }
        }else{
        	return $tabs;
        }
      return $t;
    },10,3);
    And it no longer shows the tabs to the instructor, only to the administrator, however, the content of the "Admin" tab continues loading by default for the instructor, which would still allow him to remove students from the course and that's one of the things I want to avoid. https://drive.google.com/file/d/1rFvtVVOE9AXiqPexivMjuw39EW1oAPrz/view?usp=sharing
    #373997
    Veronica
    Moderator
    hi yes right this is an issue
    #374013
    Elite
    Participant
    Any workaround? Is it possible to activate by default any of the other visible tabs when entering to view the course?
    #374034
    Veronica
    Moderator
    for now no, but I have created the Trello card so you can check the progress https://trello.com/c/j7aSNLBB will be fixed with upcoming updates
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Hide tabs for instructor only’ is closed to new replies.