Search code examples
wordpresstabsprofilebuddypressmembers

Remove tabs and pages from BuddyPress profile


i want to remove several tabs from the profile of any Buddypress user.

I know, that i can remove them with something like this:

$bp->bp_nav['groups'] = false;

This works fine and removes the tabs. The problem is that the pages are still there and can be opened by typing in the url.

Is there any solution to deactivate these pages without deactivating the whole function? I need this for following tabs: activity, groups and friends.


Solution

  • If you remove Activity, you need to change the default tab.

    From the codex

    "By default BuddyPress will load the Activity tab when clicking on a users profile link. If you would like to change this default landing tab to something else than the Activity tab you can do so"

    /**
     * Change BuddyPress default Members landing tab.
     */
    define('BP_DEFAULT_COMPONENT', 'profile' );
    

    To make sure that the templates don't load, you could create a template overload of this file: \buddypress\bp-templates\bp-legacy\buddypress\members\single\home.php

    And remove the template calls that you don't want.

    codex re template overloading

    Or you could overload each template and remove the code and insert a simple redirect:

    bp_core_redirect( get_option('home') );