Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › can i setup which course tab show or hide?
- This topic has 13 replies, 3 voices, and was last updated 2 years, 10 months ago by Scott Lang.
Viewing 14 posts - 1 through 14 (of 14 total)
-
AuthorPosts
-
May 14, 2021 at 8:35 am #357325rockylinSpectatorcan i setup which course tab show or hide? https://prnt.sc/12wzdhbMay 14, 2021 at 1:02 pm #357392Scott LangModeratorYou can hide tabs using tabs key from this custom code where mytab_key1 and mytab_key2 is specific tab key. You can found tab key from here https://prnt.sc/12xaolr
add_filter('bp_course_api_get_instructor_tabs',function($tabs,$course_id){ $ntabs = array(); $which_tabs_to_remove = ['mytab_key1','mytab_key2']; foreach ($tabs as $key => $tab) { if(!in_array($tab['key'],$which_tabs_to_remove)){ $ntabs[] = $tab; } } return $ntabs; },99,2);
May 14, 2021 at 1:08 pm #357394Scott LangModeratorCheck this image to remove edit_course tabs which is removed at my end using custom code https://prnt.sc/12xaw7cMay 14, 2021 at 2:03 pm #357421rockylinSpectatorhi Scott, it sounds the custom code hide the Manage Courses's course tab, but i want to hide is Enrolled course's course tab.May 15, 2021 at 6:20 am #357486Scott LangModeratorYes you can use this code where mytab_key1 and mytab_key2 is specific tab key. You can found tab key from here https://prnt.sc/12y9lb9
If you facing an issue in finding a key then let us know we will share it with you.add_filter('wplms_get_course_tabs',function($tabs,$course_id,$user_id){ $ntabs = array(); $which_tabs_to_remove = ['mytab_key1','mytab_key2']; foreach ($tabs as $key => $tab) { if(!in_array($key,$which_tabs_to_remove)){ $ntabs[$key] = $tab; } } return $ntabs; },99,3);
May 25, 2021 at 3:33 am #358888rockylinSpectatoralready hide tab what i want but forum tab, can you tell me how to hide forums tab , thanks.May 25, 2021 at 5:30 am #358899Scott LangModeratorPlease share an image where you want to hide. Also, we need to see the credential to see where the tabs showing for the key.May 25, 2021 at 6:14 am #358911rockylinSpectatorhere is what i want to hide:https://prnt.sc/13drohx key:https://prnt.sc/13drizjMay 25, 2021 at 6:56 am #358926Scott LangModeratorChecked at your end already you already removed the Forum tab check this https://prnt.sc/13dtgsi Let me know if issue resolved or share the credential of user .May 25, 2021 at 7:25 am #358931rockylinSpectatorsorry my bad, that i use space translate to replace forum. please check it again.May 25, 2021 at 8:06 am #358935Scott LangModeratorFixes added at your end check this https://prnt.sc/13dwmhd For forum, it does not have the exact key it needed forum id too which is fixed at your end. Custom code is:
Let me know if the issue is resolved and we can close this thread.add_filter('wplms_get_course_tabs',function($tabs,$course_id,$user_id){ $ntabs = array(); $which_tabs_to_remove = ['announcementsnews','qna','notes','curriculum','forums']; $forum_id = get_post_meta($course_id,'vibe_forum',true); if(!empty($forum_id)){ $which_tabs_to_remove[] = 'external__forums_forums_'.$forum_id; } foreach ($tabs as $key => $tab) { if(!in_array($key,$which_tabs_to_remove)){ $ntabs[$key] = $tab; } } return $ntabs; },99,3);
May 25, 2021 at 8:09 am #358936rockylinSpectatorthanks, it working, you can close this one.May 25, 2021 at 11:15 am #358957VeronicaModeratorthanks for your confirmationMay 25, 2021 at 12:42 pm #358977Scott LangModeratorClosing this topic. -
AuthorPosts
Viewing 14 posts - 1 through 14 (of 14 total)
- The topic ‘can i setup which course tab show or hide?’ is closed to new replies.