Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bp_core_remove_nav_item'

Viewing 5 results - 126 through 130 (of 130 total)
  • Author
    Search Results
  • #57583
    Anass Rhamar
    Participant

    Hi,

    Tim was 99% right – you just need to hook it into “plugins_loaded”. That’s it. This one works for me:

    function remove_navitems()
    {
    bp_core_remove_nav_item('blogs');
    }
    add_action('plugins_loaded', 'remove_navitems');

    Cheers

    #56543

    In reply to: Editing Navigation

    Anonymous User 96400
    Inactive

    This is being handled with functions like these:

    bp_core_new_nav_item

    bp_core_new_subnav_item

    bp_core_remove_nav_item

    bp_core_remove_subnav_item

    All of these functions (and a lot more) can be found in buddypress/bp-core.php. They are well documented and you can always have a look at the various core component how they use these functions.

    To the admin bar you can add links like so:

    function sv_add_link()
    {
    global $bp;

    $link = '<li><a href="'. $bp->loggedin_user->domain . 'my-page" title="'. __( 'My Page') .'">'. __( 'My Page') .'</a></li>';
    echo $link;
    }
    }
    add_action( 'bp_adminbar_menus', 'sv_add_link' );

    Removing links also works with actions. Using the example from above you’d have to put this into your functions.php file:

    remove_action( 'bp_adminbar_menus', 'sv_add_link' )

    You have to remove an action at the same priority as it has been added, so if you find an add_action call like this:

    add_action( 'bp_adminbar_menus', 'sv_add_link' , 7 );

    you’d have to remove it with this:

    remove_action( 'bp_adminbar_menus', 'sv_add_link' , 7 );

    Otherwise it won’t work.

    Hope this helps you along a bit.

    #47489
    3125432
    Inactive

    Hi –

    I wanted to do something similar – remove ‘Edit Profile’ from the MY PROFILE nav section.

    I tried using this code in bp-custom.php:

    function remove_navitems()

    {

    bp_core_remove_nav_item(‘profile_edit’);

    }

    add_action(‘bp_core_setup_nav’, ‘remove_navitems’);

    That didn’t work.

    As you can see, I was just totally guessing as to the exact name of the nav item. I have no idea where to find it, or what file to examine to find the correct nav item to reference. Any help or suggestion would be greatly appreciated.

    Thanks,

    Brian

    #45351
    Tim Moore
    Participant

    I believe you can put it in /plugins/bp-custom.php (create the file if it doesn’t exist already). This is rough code, but I’m assuming you’ll want to do it like this:

    function remove_navitems()
    {
    bp_core_remove_nav_item('blogs');
    }

    add_action('bp_core_setup_nav', 'remove_navitems');

    At a first glance, that is what I’d try. Not sure if it’ll work, but that should get you going in the right direction.

    #45334
    Tim Moore
    Participant

    There’s also a function you could probably use via a hook:

    bp_core_remove_nav_item($name)

    Replace $name with the name of the nav item you want removed.

Viewing 5 results - 126 through 130 (of 130 total)
Skip to toolbar