can i setup which course tab show or hide?

Home Forums Legacy Support Support queries How-to & Troubleshooting can i setup which course tab show or hide?

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #357325
    rockylin
    Spectator
    can i setup which course tab show or hide? https://prnt.sc/12wzdhb
    #357392
    Scott Lang
    Moderator
    You 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);
    
    #357394
    Scott Lang
    Moderator
    Check this image to remove edit_course tabs which is removed at my end using custom code https://prnt.sc/12xaw7c
    #357421
    rockylin
    Spectator
    hi Scott, it sounds the custom code hide the Manage Courses's course tab, but i want to hide is Enrolled course's course tab.
    #357486
    Scott Lang
    Moderator
    Yes 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
    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);
    
    If you facing an issue in finding a key then let us know we will share it with you.
    #358888
    rockylin
    Spectator
    already hide tab what i want but forum tab, can you tell me how to hide forums tab , thanks.
    #358899
    Scott Lang
    Moderator
    Please share an image where you want to hide. Also, we need to see the credential to see where the tabs showing for the key.
    #358911
    rockylin
    Spectator
    here is what i want to hide:https://prnt.sc/13drohx key:https://prnt.sc/13drizj
    #358926
    Scott Lang
    Moderator
    Checked 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 .
    #358931
    rockylin
    Spectator
    sorry my bad, that i use space translate to replace forum. please check it again.
    #358935
    Scott Lang
    Moderator
    Fixes 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:
    
    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);
    
    Let me know if the issue is resolved and we can close this thread.
    #358936
    rockylin
    Spectator
    thanks, it working, you can close this one.
    #358957
    Veronica
    Moderator
    thanks for your confirmation
    #358977
    Scott Lang
    Moderator
    Closing this topic.
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.