Search Results for 'bp_core_remove_nav_item'
-
AuthorSearch Results
-
September 21, 2010 at 5:44 am #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?
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!
September 7, 2010 at 11:51 am #91760Boone 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.
September 7, 2010 at 4:05 am #91731ri-kun
Participantwait, 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 ); ?>`September 6, 2010 at 4:25 pm #91667Boone Gorges
KeymasterThe 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 );`September 6, 2010 at 2:28 pm #91660PapaTango
MemberSorry 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
September 5, 2010 at 10:21 pm #91626Boone Gorges
KeymasterRoger’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.
September 5, 2010 at 10:10 pm #91625Roger Coathup
ParticipantYou 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 )June 24, 2010 at 6:50 pm #82613Boone Gorges
KeymasterTry putting this in your plugins/bp-custom.php file:
function remove_blogs_nav_for_zero() {
global $bp;if ( bp_blogs_total_blogs_for_user() == 0 )
bp_core_remove_nav_item( $bp->blogs->slug );
}
add_action( 'bp_setup_nav', 'remove_blogs_nav_for_zero', 11 );
March 25, 2010 at 8:17 pm #70152In reply to: Cleaning Tabs in Profile-View
Andy Peatling
KeymasterDon’t dig around in the array, use
bp_core_remove_nav_item() and bp_core_remove_subnav_item()
November 27, 2009 at 11:58 am #57583In reply to: Deleting a certain part of the navigation
Anass Rhamar
ParticipantHi,
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
November 12, 2009 at 1:54 pm #56543In reply to: Editing Navigation
Anonymous User 96400
InactiveThis is being handled with functions like these:
bp_core_new_nav_itembp_core_new_subnav_itembp_core_remove_nav_itembp_core_remove_subnav_itemAll 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.
June 15, 2009 at 3:58 am #47489In reply to: Deleting a certain part of the navigation
3125432
InactiveHi –
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
May 14, 2009 at 6:19 pm #45351In reply to: Deleting a certain part of the navigation
Tim Moore
ParticipantI 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.
May 14, 2009 at 2:38 pm #45334In reply to: Deleting a certain part of the navigation
Tim Moore
ParticipantThere’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.
-
AuthorSearch Results