Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_remove_nav_item'

Viewing 25 results - 126 through 150 (of 157 total)
  • Author
    Search Results
  • #123678

    In reply to: Moving Links around

    leethompson
    Member

    ok, I found out if you remove a parent item the page(function) is removed too, So I removed this function:
    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );`

    and I used css to hide the parent item. In my themes main css I added :

    `#user-privacy {
    display: none !important;
    }

    #user-settings {
    display: none !important;

    }
    `

    Now I will write a javascript function to highlight the right parent item if I am in the proper section.

    Then i will try to write a bp global function to re-assign subnav items to different parent item.

    leethompson
    Member

    This is a great post but what about moving sub links to a new parent item, this kinda works but if I remove the parent item the function stops. in my themes functions.php

    `function remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘remove_blogs_nav’, 15 );

    function bp_add_create_group_subnav() {
    global $bp;
    $groups_link = ‘/groups-2/’;
    $settings_link = $bp->loggedin_user->domain ;

    /* Add the subnav items to the groups nav item */
    if (function_exists(‘bp_core_new_subnav_item’)) {
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Create Clan’, ‘buddypress’ ),
    ‘slug’ => ‘create’,
    ‘parent_url’ => $groups_link,
    ‘parent_slug’ => $bp->groups->slug,
    ‘screen_function’ => ‘groups_screen_group_home’,
    ‘position’ => 40,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Settings’, ‘buddypress’ ),
    ‘slug’ => ‘settings’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘profile-settings’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘profile-settings’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Privacy’, ‘buddypress’ ),
    ‘slug’ => ‘privacy’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘profile-privacy’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘profile-privacy’ ) );

    }
    }
    add_action(‘bp_setup_nav’, ‘bp_add_create_group_subnav’);
    `
    If I comment out :
    `// bp_core_remove_nav_item( ‘privacy’ );
    // bp_core_remove_nav_item( ‘settings’ );`

    The sub links are in the Profile item, and functional, but still link to each original man item.

    thanks Boone you are a lot of help

    #25468
    leethompson
    Member

    Hello Everyone,
    I am trying to move some links around from the main Nav to the sub nav ie:
    sub of Profile
    Privacy
    Settings

    Sub of MyGroups
    Create

    I have added the following code to my themes function.php and it moves the links as I want, but the first part bp_core_remove_nav_item seems to disable the page load.

    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );

    function bp_add_create_group_subnav() {
    global $bp;
    $groups_link = ‘/groups-2/’;
    $settings_link = $bp->loggedin_user->domain ;

    /* Add the subnav items to the groups nav item */
    if (function_exists(‘bp_core_new_subnav_item’)) {
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Create Clan’, ‘buddypress’ ),
    ‘slug’ => ‘create’,
    ‘parent_url’ => $groups_link,
    ‘parent_slug’ => $bp->groups->slug,
    ‘screen_function’ => ‘groups_screen_group_home’,
    ‘position’ => 40,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Settings’, ‘buddypress’ ),
    ‘slug’ => ‘settings’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Privacy’, ‘buddypress’ ),
    ‘slug’ => ‘privacy’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    }
    }
    add_action(‘groups_setup_nav’, ‘bp_add_create_group_subnav’);
    `
    I was wondering what I am doing wrong?

    thanks in advance.

    #25461
    leethompson
    Member

    Hello all,
    This question is strange but how do I move links from the main nav to the sub nav under a specific parent_slug. i have tried this and it works kinda, except when i remove the links the function stops. In my themes functions.php i added:

    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘privacy’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘invite-anyone’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );

    function bp_add_create_group_subnav() {
    global $bp;
    $groups_link = ‘/groups-2/’;
    $settings_link = $bp->loggedin_user->domain ;

    /* Add the subnav items to the groups nav item */
    if (function_exists(‘bp_core_new_subnav_item’)) {
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Create Clan’, ‘buddypress’ ),
    ‘slug’ => ‘create’,
    ‘parent_url’ => $groups_link,
    ‘parent_slug’ => $bp->groups->slug,
    ‘screen_function’ => ‘groups_screen_group_home’,
    ‘position’ => 40,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Settings’, ‘buddypress’ ),
    ‘slug’ => ‘settings’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Privacy’, ‘buddypress’ ),
    ‘slug’ => ‘privacy’,
    ‘parent_url’ => $settings_link,
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘xprofile_screen_edit_profile_mmc’,
    ‘position’ => 30,
    ‘item_css_id’ => ‘home’ ) );

    }
    }
    add_action(‘groups_setup_nav’, ‘bp_add_create_group_subnav’);
    `

    I would like to create my links like this:

    Main
    Send Invites

    sub of Profile
    Privacy
    Settings

    Sub of MyGroups
    Create a group

    #121845
    Sven Lehnert
    Participant

    add it in your function.php

    function remove_group_home_nav() {
    bp_core_remove_nav_item( bp_get_current_group_slug(), ‘home’ );
    }
    add_action( ‘bp_setup_nav’, ‘remove_group_home_nav’ );

    jonnyauk
    Participant

    Ah, my mistake – this code does actually work HOWEVER , I can’t get it to hide ‘Send Invites’ or anything else under the group menu… do I have to do something different?

    `function ja_remove_navigation_tabs() {
    bp_core_remove_nav_item(‘friends’);
    bp_core_remove_nav_item(‘settings’);
    }
    add_action( ‘bp_setup_nav’, ‘ja_remove_navigation_tabs’, 15 );`

    jonnyauk
    Participant

    I’m developing on the trunk version of BP and seem to have hit a bit of a road block when trying to manipulate the BuddyPress menus.

    As per https://bpdevel.wordpress.com/2011/08/05/how-bp-1-5-load-order-changes-may-affect-your-plugins-or-themes/ I have tried the following functions wrapped up in a function and hooked upto bp_setup_nav ie:
    `
    function ja_remove_activity_friends_subnav() {
    bp_core_remove_subnav_item( ‘activity’, ‘friends’ );
    }
    add_action( ‘bp_setup_nav’, ‘ja_remove_activity_friends_subnav’, 15 );
    `

    This is in my bp-custom.php file in plugins. Sadly, it doesn’t seem to do anything;(

    I think I may be getting confused between bp_core_remove_nav_item() and bp_core_remove_subnav() – no matter what I try the menu remains unaffected.

    I have tried things like `bp_core_remove_nav_item($bp->groups->slug, ‘send-invites’);` inside the function too, but without success.

    Am I doing something wrong – I’d hate to hack the core, but it may come to it if I can’t get this working sadly;( Any help would be much appreciated thanks!

    r-a-y
    Keymaster

    @nahummadrid – This is a known bug. Using bp_core_remove_nav_item() will remove access to those pages as well. Right now, I’d suggest hiding the nav item via CSS or by hacking the $bp global to remove the item.

    Nahum
    Participant

    `function boone_remove_groups_nav() {
    bp_core_remove_nav_item( ‘groups’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_groups_nav’, 15 );
    `
    When I put in functions it doesn’t work at all. The only way i get this to work is putting it in the BP-Custom but then it cuts off all access to groups and forum subpages….can’t figure why

    Nahum
    Participant

    I thought the same would work for groups…but it’s throwing the group count # up above the header when I use alone or in conjunction with the blogs snippet.

    `function remove_groups_nav_for_zero() {
    global $bp;
    if ( bp_groups_total_count_for_user() == 0 )
    bp_core_remove_nav_item( $bp->groups->slug );
    }
    add_action( ‘bp_setup_nav’, ‘remove_groups_nav_for_zero’, 11 );
    `

    Any ideas why this is happening…and not with the blogs one.

    #107146
    pcwriter
    Participant

    @christophG

    You can do this with the s2member plugin. In the “API/Scripting” section, you’ll find some advanced conditionals that can be added in your theme templates, or included in a custom function. If you’re using s2member, you could try adding this to your theme’s functions.php file… should work anyway ;-)

    `function remove_member_profile_nav() {
    if (!current_user_can(‘access_s2member_level1’)) {
    bp_core_remove_nav_item( ‘profile’ );
    }
    }
    add_action( ‘bp_setup_nav’, ‘remove_member_profile_nav’, 15 );`

    #20261
    ping
    Member

    Short of changing core buddypressbp-activity.php, I haven’t been able to change the activity’s default_subnav_slug from Personal to Friends.

    Does anyone have a clue?

    I’m copied the whole bp_activity_setup_nav (from bp-activity.php) into a custom function inside the theme’s functions.php

    function my_bp_activity_setup_nav {

    global $bp;

    bp_core_remove_nav_item(‘activity’);

    bp_core_new_nav_item( array( ‘name’ => __( ‘Activity’, ‘buddypress’ ), ‘slug’ => $bp->activity->slug, ‘position’ => 10, ‘screen_function’ => ‘bp_activity_screen_friends’, ‘default_subnav_slug’ => ‘friends’, ‘item_css_id’ => $bp->activity->id ) );

    // rest of original bp_activity_setup_nav but with subnav positions changed
    }
    add_action( ‘wp’, ‘my_bp_activity_setup_nav’);

    This did not work. I’m at a total lost because the changed subnav item positions in my_bp_activity_setup_nav() is reflected. Just not the default_subnav_slug / screen_function for Activity.

    shanebp
    Moderator

    I need to remove “Following” and “Followers” from the Profile nav.
    I can remove other links using the function below in bp-custom.php
    But Follow links still appear.
    I’ve tried various priority values.
    Perhaps I am calling the wrong tag in the add_action ?
    `
    function sc_remove_nav_tabs() {
    /* works great */
    bp_core_remove_nav_item( ‘events’ );
    bp_core_remove_nav_item( ‘friends’ );
    bp_core_remove_subnav_item( ‘activity’, ‘friends’ );

    /* doesn’t work*/
    bp_core_remove_nav_item( ‘followers’ );
    bp_core_remove_nav_item( ‘following’ );
    bp_core_remove_subnav_item( ‘activity’, ‘following’ );

    }
    add_action( ‘bp_setup_nav’, ‘sc_remove_nav_tabs’, 15 );
    //add_action( ‘xprofile_setup_nav’, ‘sc_remove_nav_tabs’ );
    `

    Also tried, without success:
    bp_core_remove_subnav_item( $bp->activity->slug, ‘following’ );

    #103461

    In reply to: Hide General Settings

    r-a-y
    Keymaster

    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…

    #16888
    ltnp
    Member

    Is there any way to hide the subnav items without removing the items from the adminbar? A search gave me the following codes:

    function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘friends’ );
    bp_core_remove_nav_item( ‘settings’ );
    bp_core_remove_nav_item( ‘groups’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );

    When I use this code I remove the items from the subnav and the adminbar. The user is no longer able to use the functions. The reason for asking this is that the subnav menus is also available on the adminbar on top of the page. It is not necessary to have same menu on several places on the page.

    I have also problem removing the actions “Followers” and “Following”. It seems that these actions does not response to the code I use.

    Thank you for helping me solve this problem!

    Regards
    Phuong

    #98864
    Brajesh Singh
    Participant

    Hi,
    The private updates on group should not be visible to anyone other than the profile owner. It means something is wrong, you should check other plugins.
    btw, yes, you can remove the activity section from profile. put the following code in your theme’s functions.php

    `
    global $bp;
    bp_core_remove_nav_item($bp->activity->id);
    `
    But this will make the profile inaccessible, as activity is set as the default profile component. so you may want to put the following code in bp-custom.php
    `
    define(“BP_DEFAULT_COMPONENT”, “profile”);
    `
    hope that helps.

    #93042
    youngmicroserf
    Participant

    I’m bumping this because the @-mention above didn’t work, apparently.

    @boonebgorges,

    for some reason, your suggested solution doesn’t work. I suppose it has to do with the hook, but using bp_core_remove_nav_item(‘groups’) doesn’t work at ‘bp_setup_nav’, while it does work at the point @mariochampion suggested.

    Here’s a problem, though, in my installation, when I remove the nav link, I am no longer able to access group pages. I can access the group directory and groups will be displayed there, but clicking on a group will take me to the front page. Is this a bug? It seems like it, since the function is supposed to only remove the navigation item, not access to the feature, am I right? Or am I not getting something? Is there a better way to remove the navigation item?

    #92986
    youngmicroserf
    Participant

    Hmm. Is this the intended effect? I removed the “groups” element from the navigation bar on the profile using the bp_core_remove_nav_item-function, but after doing that I was no longer able to access any group and after directly entering the group’s URL I will be redirected to the homepage. Is there any way to remove items from the *navigation* but keep them available for direct access? Bizarrely, I am able to display the groups directory page when the bp_core_remove_nav_item(‘groups’)-function is active, but not individual group homepages. Clicking on a group name will take me to the homepage.

    Are there other options for menu item removal?

    Thanks!

    #92984
    youngmicroserf
    Participant

    @Boone Gorges,

    using bp_core_remove_nav_item( ‘blogs’ ) at bp_setup_nav didn’t work for me. But putting it in mariochampions function right after “global $bp” did – any idea why?

    @mariochampion,

    sorry, but I’m new to BP, and I can’t find the xprofile-settings.php you’re referring to above – could you give me a hand? Could you also indicate where you changed the slugs in the copied file?

    Thanks!

    #91760
    Boone Gorges
    Keymaster

    @blogmudgeon Glad to help :)

    @ri-kun bp_core_remove_nav_item doesn’t take multiple arguments. Try something like:
    `<?php function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘blogs’ );
    bp_core_remove_nav_item( ‘groups’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 ); ?>`

    Add additional lines for nav items you want to remove. And make them lowercase, as the names might be case-sensitive and they are almost certainly lowercase when they are initially added.

    functions.php, in your theme directory, is the appropriate place to put this. There should be no function called bp-functions.php.

    ri-kun
    Participant

    wait, I tried to add this on my bp-functions.php and functions.php but it didnt remove anything from the nav:

    `<?php function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘Profile’,’Blogs’,’Quick Post’,’Messages’,’Friends’,’Groups’,’Points’,’Settings’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 ); ?>`

    Boone Gorges
    Keymaster

    The following function, placed into your theme’s functions.php or bp-custom.php file, will remove the Blogs nav item from the Members section of the site:
    `function boone_remove_blogs_nav() {
    bp_core_remove_nav_item( ‘blogs’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_blogs_nav’, 15 );`

    Other top-level nav items can be removed by replacing ‘blogs’ with the appropriate name. Subnav items will work in a similar way, except using `bp_core_remove_subnav_item` and the extra $parent_id argument:
    `function boone_remove_friends_activity_nav() {
    bp_core_remove_subnav_item( ‘activity’, ‘friends’ );
    }
    add_action( ‘bp_setup_nav’, ‘boone_remove_friends_activity_nav’, 15 );`

    PapaTango
    Member

    Sorry to say, a lot of us on the end publishing equation are not programmers… I used EngineSite to find the string, but have no clue as to where the parent ID for the menu item is to be found. even then, is it simply a matter of entering that ID into the argument?

    ‘/**
    * bp_core_remove_nav_item()
    *
    * Removes a navigation item from the sub navigation array used in BuddyPress themes.
    *
    * @package BuddyPress Core
    * @param $parent_id The id of the parent navigation item.
    * @param $slug The slug of the sub navigation item.
    */
    function bp_core_remove_nav_item( $parent_id ) {
    global $bp;

    /* Unset subnav items for this nav item */
    if ( is_array( $bp->bp_options_nav[$parent_id] ) ) {
    foreach( (array)$bp->bp_options_nav[$parent_id] as $subnav_item ) {
    bp_core_remove_subnav_item( $parent_id, $subnav_item );
    }
    }

    unset( $bp->bp_nav[$parent_id] );’

    Thanks!

    P

    #91626
    Boone Gorges
    Keymaster

    Roger’s right – bp_core_remove_nav_item() is the function you want. See bp-core.php to see how that function works.

    Also, please don’t bump your question more than once every few days. This board is not so well-trafficked that you can expect an answer to every question within a few hours, especially on the weekend.

    #91625
    Roger Coathup
    Participant

    You could look at adding a filter on: bp_get_displayed_user_nav_ . $user_nav_item to remove the blog menu.

    Or, take a look at these functions in bp-core.php:

    function bp_core_new_nav_item( $args = ” )
    function bp_core_remove_nav_item( $parent_id )

Viewing 25 results - 126 through 150 (of 157 total)
Skip to toolbar