Wordpress - Buddypress Plugin

I want to hide sub-navigation in profile settings

enter image description here

I am hiding a comment south of the user "wp-content \ plugins \ buddypress \ bp-settings \ bp-settings-loader.php"

// Add General Settings nav item
    $sub_nav[] = array(
        'name'            => __( 'General', 'buddypress' ),
        'slug'            => 'general',
        'parent_url'      => $settings_link,
        'parent_slug'     => $this->slug,
        'screen_function' => 'bp_settings_screen_general',
        'position'        => 10,
        'user_has_access' => bp_core_can_edit_settings()
    );
+4
source share
1 answer

What sub-navigation element do you mean? If you want to completely remove the "Settings" parameter, you can do this in the plugin or functions.php

function my_admin_bar_mod(){
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu( 'my-account-settings' );
}
add_action('wp_before_admin_bar_render','my_admin_bar_mod');

To remove only the Profile option in the Settings section, use this instead:

$wp_admin_bar->remove_menu( 'my-account-settings-profile' );

UPDATE:

""; , , . ? , . , "" 4040. ?

function mcs_bp_remove_nav() {
    global $bp;
    bp_core_remove_subnav_item( $bp->settings->slug, 'general' );
}
add_action( 'bp_setup_nav', 'mcs_bp_remove_nav', 99);

:

. , " ". , , 404. , , "".

function mcs_bp_change_settings() {
    global $bp;
    // point setting to Email page (aka 'notifications')
    $args = array(  'parent_slug' => 'settings',
        'screen_function' => 'bp_core_screen_notification_settings',
        'subnav_slug' => 'notifications'
    );
    bp_core_new_nav_default( $args );
}
add_action( 'bp_setup_nav','mcs_bp_change_settingst', 5);
+1

Source: https://habr.com/ru/post/1628250/


All Articles