Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Remove and Add Items in “bp_get_displayed_user_nav”

  • Avatar of ri-kun
    ri-kun
    Participant

    @ri-kun


    TO UNDERSTAND MY QUESTION CLEARLY PLEASE VIEW THIS SCREENCAP I MADE:



    I am simply trying to remove the “blog” link and other items in the bp subnav for the profile section and would like to add other items/links… I am trying to gain some control over what items appear in the profile subnav..

    I cannot seem to determine where BP decides what items get placed in the subnav array when is called.

    Do you have any light to shine on how user nav’s are set as “display-able”.. is there a place where which subnav items are supposed to be display are determined?


    TO UNDERSTAND MY QUESTION CLEARLY PLEASE VIEW THIS SCREENCAP I MADE:


Viewing 12 replies - 26 through 37 (of 37 total)
  • Avatar of Youngmicroserf
    youngmicroserf
    Participant

    @youngmicroserf

    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!

    Avatar of Youngmicroserf
    youngmicroserf
    Participant

    @youngmicroserf

    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?

    Avatar of Patrik
    Patrik
    Participant

    @patrikp

    @youngmicroserf I’m having the same issue with the example that @mariochampion provided.

    mariochampion or anyone else who knows; it would be very helpfull if you could tell what to change. I assume it’s the xprofile.php file we should copy and edit since I can’t find a file named xprofile-setting.php.

    It is a bug, we have a ticket: http://trac.buddypress.org/ticket/2644

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @boonebgorges – given the bug fix / re-engineering is scheduled for 1.3, I’m guessing the best short term workaround is to hard code our own bespoke user nav

    Avatar of imjscn
    imjscn
    Participant

    @imjscn

    Last year Boone’s code worked (I used it in bp-custom.php), now, after several BP upgrades, it generate error message.
    Currently, I get erro of “in ……/plugins/invite-anyone/by-email/by-email.php on line 390″

    I tried the solution posted here http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-remove-and-add-items-in-bp_get_displayed_user_nav#post-71009 and it is not working for me. Is it possible that the code changed with the recent update (I think it was 1.2.8)?

    I could really use some help here.

    Thanks in advance.

    Avatar of Nm
    nm
    Participant

    @nahummadrid

    `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

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

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

    Avatar of Nm
    nm
    Participant

    @nahummadrid

    @r-a-y thanks…I’ve been doing alot of display:none! Lately.

    Avatar of leethompson
    leethompson
    Member

    @leethompson

    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

    Avatar of workinclasshero
    workinclasshero
    Participant

    @workinclasshero

    Be careful using this function because I used it on the friends tab and it removed the ability to accept friend requests. It is much easier to just target the specific tab using css such as:

    #friends-personal-li{
    display:none;
    }
    #groups-personal-li{
    display:none;
    }
    #notifications-personal-li{
    display:none;
    }

    This will remove the items but will allow friends requests to still function properly.

Viewing 12 replies - 26 through 37 (of 37 total)

The topic ‘How to Remove and Add Items in “bp_get_displayed_user_nav”’ is closed to new replies.