Skip to:

Removing Settings General tab redirect to Other Tab

  • kenmcall



    We are using LDAP to populate and maintain our Buddypress members list, and because of this we don’t want people to be able to change their password or email address via the Settings > General tab. We would like to therefore hide the General tab and have Settings redirect to a different tab instead (preferably Settings > Profile)

    I have gone through the forums and have viewed other posts by people dealing with the same issue, specifically this one:

    How to hide / remove the General tab under Settings

    Here’s the code:

    function bpex_change_profile_settings_default_tab() {
    	if( bp_is_active( 'xprofile' ) ) :
    	$access        = bp_core_can_edit_settings();
    	$slug          = bp_get_settings_slug();
    	$args = array(
    		'parent_slug'     => $slug,
    		'subnav_slug'	  => 'notifications',
    		'screen_function' => 'bp_settings_screen_notification',
    		'user_has_access' => $access
    	bp_core_new_nav_default( $args );
    add_action( 'bp_actions', 'bpex_change_profile_settings_default_tab' );
    function bpex_remove_general_item_on_usermenu() {
    global $wp_admin_bar;
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-settings-general' );
    add_action( 'wp_before_admin_bar_render', 'bpex_remove_general_item_on_usermenu' );
    function bpex_remove_profile_settings_general_tab() {
    	if( bp_is_active( 'xprofile' ) ) :	
    		bp_core_remove_subnav_item( 'settings', 'general' );
    add_action( 'bp_actions', 'bpex_remove_profile_settings_general_tab' );

    This seems to be the solution I need, but when I add the code to bp-custom.php it does remove the General tab, but now clicking on Settings generates a 404 error. As this post is over a year old, I’m wondering if there have been changes to Buddypress that stops this from working.

    I should mention that I’ve done some (but not a lot) of PHP programming. I did have a co-oworker who is quite proficient at PHP look over this with me, but everything we tried failed to work.

    Thanks for any help anyone can give.

Viewing 4 replies - 1 through 4 (of 4 total)

  • ripulkr


    You need to remove the nav item at the book ‘bp_setup_nav’ hook.



    Should have mentioned that I’m running WordPress 4.9.7 and Buddypress 3.1, along with the BuddyBoss Boss theme 2.4.3.



    If you remove a main navigation item, you have to replace it with another, otherwise the 404 is expected.

    For now, I would just override the template for the “Settings > General” screen and add some text. The other option is to redirect to another page like “Settings > Email”.



    That’s what I’m trying to do, and what I believe the function bpex_change_profile_settings_default_tab is supposed to do. And I’m almost positive it was working before the upgrade to Buddypress 3. I had to leave the project for over a month and came back to it after the upgrade. I’ve found multiple sources/tutorials that give instructions on how to accomplish this, but all are pre version 3, and none now seem to work.

    The override Settings > General screen is not my ideal solution, but it might be a good stop-gap. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar