1. Developer Tutorials
  2. Changing Profile & Group Tabs Visibility & Icons

Changing Profile & Group Tabs Visibility & Icons

In this tutorial, you will learn about the different filters that you can use to hide all tabs or specific tabs in the app. You will also look into the filters that can be used to add icons to all/specific tabs. The filters given are for both profile and group navigation options in the app. We also have a tutorial on how to display custom tabs for Member Profiles and Social Groups in the BuddyBoss app that you may find useful in your custom app development process.

Profile Navigation

bbapp_profile_tab_visibility

Enable/Disable profile tab visibility within your app using this filter.

Hide specific tab

You can set your profile tab visibility to true or false. The function can be used to hide a specific tab. Insert the tab ID of the tab you want to hide in the App side to hide that specific tab.

/**
* @param $status
* @param $tab
* @param $nav
*
* @return bool
*/
function bbapp_profile_tab_visibility_callback( $status, $tab, $nav ) {
	// You can pass any tab id here to hide a specific tab in the App side.
	if ( 'activities' === $tab['id'] ) {
	     return true;
	}
	return $status;
}
add_filter( 'bbapp_profile_tab_visibility', 'bbapp_profile_tab_visibility_callback', 10, 3 );

bbapp_profile_child_tab_visibility

Enable/Disable showing the profile child tab for your app using this filter.

Hide specific children tab

The filter allows hiding specific subtabs from the menu. You would need to pass the children tab ID to hide the specific children tab. 

/**
 * @param $status
 * @param $children_tab
 * @param $tab
 * @param $nav
 *
 * @return bool
 */
function bbapp_profile_child_tab_visibility_callback( $status, $children_tab, $tab, $nav ) {
    // You can pass any children tab id here to hide a specific children tab in the App side.
    if ( 'general' === $children_tab['id'] ) {
        return true;
    }
    return $status;
}
add_filter( 'bbapp_profile_child_tab_visibility', 'bbapp_profile_child_tab_visibility_callback', 10, 4 );

bbapp_profile_tab_icon

You can enable/disable profile tab icons for your app users with this filter.

Add icon to a specific tab

You can also use this filter to add icons to specific parent tabs in the app when you pass the tab ID of the specific tab where you want the icon to be placed.

/**
 * Function will add an icon for a specific tab in the app side.
 *
 * @param $icon_url
 * @param $tab
 * @param $nav
 *
 * @return bool
 */
function bbapp_profile_tab_icon_callback( $icon_url, $tab, $nav ) {
    // You can pass any tab id here to add an icon for a specific tab in the App side.
    if ( 'activities' === $tab['id'] ) {
        return bbapp()->plugin_url . "assets/img/icon.png"; // You can add your own path.
    }
    return $icon_url;
}
add_filter( 'bbapp_profile_tab_icon', 'bbapp_profile_tab_icon_callback', 10, 3 );

Group Navigation

bbapp_group_tab_visibility

Enable/Disable group tab visibility in the app.

Hide specific tab in the group navigation option

You can use the same function to hide a specific tab in the group navigation by inserting the tab ID in the code as shown below.

/**
 * Function will hide a specific tab in the group nav in the app side.
 *
 * @param $status
 * @param $navigation
 *
 * @return bool
 */
function bbapp_group_tab_visibility_callback( $status, $navigation ) {
    // You can pass any tab id here to hide a specific tab in the App side.
    if ( 'members' === $navigation['id'] ) {
        return true;
    }
    return $status;
}
add_filter( 'bbapp_group_tab_visibility', 'bbapp_group_tab_visibility_callback', 10, 2 );

bbapp_group_tab_icon

Enable/Disable the group tab icon in your app.

Add icon for the specific group tab

You can add icons for a specific group tab by using the same function by inserting the specific tab ID where you want the icon to appear as shown in the code below.

/**
 * Function will add an icon for a specific group tab on the app side.
 *
 * @param $icon_url
 * @param $navigation
 *
 * @return bool
 */
function bbapp_group_tab_icon_callback( $icon_url, $navigation ) {
    // You can pass any tab id here to add an icon for a specific group tab in the App side.
    if ( 'members' === $navigation['id'] ) {
        return bbapp()->plugin_url . "assets/img/icon.png"; // You can add your own path.
    }
    return $icon_url;
}
add_filter( 'bbapp_group_tab_icon', 'bbapp_group_tab_icon_callback', 10, 2 );

Questions?

We're always happy to help with questions you might have! Search our documentation, contact support, or connect with our sales team.