Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide General Settings

  • Is it possible to hide the General Settings tab on a user’s profile page?

    The General Settings allow a user to change their password and email address. Our users will be ActiveDirectory users so we’d like to hide or remove or disable this page.

    WP 3.0.2
    BP 1.2.5.2

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Add the following to your theme’s functions.php:

    `function ray_bp_remove_settings() {
    global $bp;

    // removing the existing settings tab
    bp_core_remove_nav_item( $bp->settings->slug );
    }
    add_action( ‘init’, ‘ray_bp_remove_settings’, 0 );

    function ray_bp_readd_settings() {
    global $bp;

    // add a new settings tab to use notifications as default tab
    bp_core_new_nav_item( array( ‘name’ => __(‘Settings’, ‘buddypress’), ‘slug’ => $bp->settings->slug, ‘position’ => 100, ‘show_for_displayed_user’ => false, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘default_subnav_slug’ => ‘notifications’ ) );

    // bug in bp_core_remove_subnav_item(), we have to hack the screen function so it displays the notifications screen when you land on /settings/
    if ( $bp->current_component == $bp->settings->slug && $bp->current_action == ‘general’ )
    add_action( ‘wp’, ‘bp_core_screen_notification_settings’, 3 );

    // add back the subnav notifications tab
    $settings_link = $bp->loggedin_user->domain . $bp->settings->slug . ‘/’;

    bp_core_new_subnav_item( array( ‘name’ => __( ‘Notifications’, ‘buddypress’ ), ‘slug’ => ‘notifications’, ‘parent_url’ => $settings_link, ‘parent_slug’ => $bp->settings->slug, ‘screen_function’ => ‘bp_core_screen_notification_settings’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );
    }
    add_action( ‘init’, ‘ray_bp_readd_settings’ );`

    Tested lightly. Encountered a few bugs, but this will work…

    Worked perfectly, thanks r-a-y

    Avatar of imjscn
    imjscn
    Participant

    @imjscn

    @r-a-y ,
    Thanks for the code! It’s perfect! Just one question–
    I not only moved the Settings but also other nav and sub-nav items, 2 of the sub-nav are added under a newly created nav slug. if a plugin adds a new item in any of the sub tab, can they find the right path? or I need to define some path for them?
    Thanks!

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

You must be logged in to reply to this topic.