Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Hide tabs for instructor only
Tagged: hide tabs for instructor
- This topic has 9 replies, 2 voices, and was last updated 2 years, 6 months ago by Veronica.
Viewing 10 posts - 1 through 10 (of 10 total)
-
AuthorPosts
-
October 25, 2021 at 9:07 pm #373536EliteParticipantHi, I am using the code from this post https://wplms.io/support/forums/topic/code-help/
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.3add_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);
October 26, 2021 at 10:35 am #373578VeronicaModeratorThis reply has been marked as private.October 26, 2021 at 1:43 pm #373602EliteParticipantMy 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.October 27, 2021 at 11:39 am #373650VeronicaModeratorno problem we can check this on your site please provide details so we can check this at your endOctober 27, 2021 at 3:32 pm #373689EliteParticipantThis reply has been marked as private.October 30, 2021 at 1:37 pm #373863VeronicaModeratorhi add this code in wplms-customizer.phpadd_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);
November 1, 2021 at 4:38 pm #373958EliteParticipantThanks for response, I adjusted the code for the "Admin" and "Edit Course" tabs:
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=sharingadd_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);
November 2, 2021 at 1:23 pm #373997VeronicaModeratorhi yes right this is an issueNovember 2, 2021 at 3:04 pm #374013EliteParticipantAny workaround? Is it possible to activate by default any of the other visible tabs when entering to view the course?November 3, 2021 at 7:57 am #374034VeronicaModeratorfor 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 -
AuthorPosts
Viewing 10 posts - 1 through 10 (of 10 total)
- The topic ‘Hide tabs for instructor only’ is closed to new replies.