Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Hide General Settings


r-a-y
Keymaster

@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…

Skip to toolbar