Search Results for 'bp_core_remove_nav_item'
-
AuthorSearch Results
-
June 16, 2016 at 6:32 pm #254694
In reply to: Remove nav items and hide header
danbp
Participantyou can use a function within bp-custom.php
Something like:function bpfr_remove_nav_tabs() { bp_core_remove_nav_item( 'messages' ); // and so on for each item you want to remove } add_action( 'bp_setup_nav', 'bpfr_remove_nav_tabs', 15 );References
nav-item
http://hookr.io/plugins/buddypress/2.4.3/functions/bp_core_remove_nav_item/
sub-nav-itemFor the header thing, see template file and made your modification from within a child-theme.
– profile pic and username: bp-templates/bp-legacy/buddypress/members/single/member-header.php
– cover image: bp-templates/bp-legacy/buddypress/members/single/profile.phpJune 4, 2016 at 7:30 pm #254137danbp
ParticipantGive this a try: (add to bp-custom.php) 1) & 2):
function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'notifications' ); bp_core_remove_subnav_item( 'messages', 'compose' ); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );3) With BP and xprofile component activated, a user doesn’t need access to WP dashboard. He can change his profile credentials from front-end.
Easiest way would be to use this plugin.Retrieving them the possibility to change their email is anyway not a good idea. What happen when a user changed from yahoo to gmail, but can’t login because he lost his password ? Where will the new pwd be sent ?
Perhaps you have also to remove this from the BP usermenu on toolbar ?
Here’s how you can do it:function admin_bar_remove_this(){ global $wp_admin_bar; $wp_admin_bar->remove_node('my-account-messages-compose'); } add_action('wp_before_admin_bar_render','admin_bar_remove_this');December 10, 2015 at 8:56 pm #247637In reply to: Buddypress privacy for tabs
shanebp
ModeratorFor standard BP profile tabs, try:
function zhubr_remove_profile_nav_item( $nav ) { if ( ! bp_is_my_profile() ) $nav = ''; return $nav; } add_filter('bp_get_displayed_user_nav_notifications', 'zhubr_remove_profile_nav_item', 20, 1 ); add_filter('bp_get_displayed_user_nav_groups', 'zhubr_remove_profile_nav_item', 20, 1 ); // add additional calls for other tabsTo remove custom tabs, try:
function zhubr_remove_custom_profile_tab() { if ( bp_is_user() && ! bp_is_my_profile() ) bp_core_remove_nav_item( 'events' ); } add_action( 'bp_ready', 'zhubr_remove_custom_profile_tab', 25 );November 10, 2015 at 9:59 am #246529In reply to: hiding groups and forums from members page
danbp
ParticipantTry
function bpfr_hide_tabs() { global $bp; /** * class_exists() & bp_is_active are recommanded to avoid problems during updates * or when Component is deactivated */ if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );November 10, 2015 at 9:58 am #246528In reply to: Want to add new tab in buddypress profile page.
danbp
Participanttry this:
function bpfr_hide_tabs() { global $bp; /** * class_exists() & bp_is_active are recommanded to avoid problems during updates * or when Component is deactivated */ if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );October 27, 2015 at 5:58 pm #246070In reply to: Hide profile tabs on user roles
pnet
ParticipantThis sounds like what I am trying to do.
I have a role “Partners” and the following function
function remove_nav_items() { bp_core_remove_nav_item( 'notifications' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'activity' ); } add_action( 'bp_setup_nav', 'remove_nav_items');How can I make an “if” statement with this function?
example: if role= ‘partners’ do remove_nav_items()I am having trouble figuring out how to get the user role of a logged in user.
September 11, 2015 at 7:07 pm #244298In reply to: [Resolved] Remove View Tab from Member Profile Page
danbp
Participanttry
function bpfr_hide_top_nav() { if( bp_is_active('xprofile' ) ) bp_core_remove_nav_item( 'profile' ); } add_action( 'bp_ready', 'bpfr_hide_top_nav' );August 13, 2015 at 10:51 am #243131In reply to: [Resolved] Removing Activity from members page
Prabin
Participantfunction remove_bp_tab() { global $bp; bp_core_remove_nav_item( 'activity' ); } add_action( 'bp_setup_nav', 'remove_bp_tab', 999 );You can use this, this will remove your activity tab from member profile
August 11, 2015 at 8:53 am #243006In reply to: hide bp sub nav name.
danbp
Participantyou apply a condition to
bp_core_remove_subnav_itemfunction.2 function to do that.
1) define the condition
2) remove the nav/subnav itemfunction bpfr_hide_nav() { $retval = false; if ( bp_is_user() && ! bp_is_my_profile() ) { $retval = true; } return $retval; } function bpfr_hide_profile_nav() { // stop if condition is not filed if ( ! bpfr_hide_nav() ) { return; } bp_core_remove_nav_item( 'friends' ); // bp topnav bp_core_remove_subnav_item( 'activity', 'friends' ); //bp subnav (my activities, my groups, etc) } add_action( 'bp_ready', 'bpfr_hide_profile_nav' );Add this to bp-custom.php
August 11, 2015 at 7:59 am #243001In reply to: Hide friendshp in sitewide activity stream
bruce7075
ParticipantYes, I have read codex abot bp-custom. I also have added php tag as below.
<?php // hide friendship activity stream sitewide function bpfr_maybe_hide_friends_nav_etc() { $retval = false; if ( bp_is_user() && ! bp_is_my_profile() && ! friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id() ) ) { $retval = true; } return $retval; } function bpfr_hide_friends_nav_to_non_friends() { // Stop if condition is not filed if ( ! bpfr_maybe_hide_friends_nav_etc() ) { return; } // otherwise, we remove the nav bp_core_remove_nav_item( 'friends' ); // bp topnav bp_core_remove_subnav_item( 'activity', 'friends' ); //bp subnav (my activities, my groups, etc) } add_action( 'bp_ready', 'bpfr_hide_friends_nav_to_non_friends' ); // we want also to remove all friends related activities to non friends function bpfr_hide_friends_activity_type_to_non_friends( $activity_action = array(), $component_id = '' ) { // if condition is not filed we go back to original output if ( 'friends' != $component_id || ! bpfr_maybe_hide_friends_nav_etc() ) { return $activity_action; } // otherwise, we remove member from context $activity_action['context'] = array_diff( $activity_action['context'], array( 'member' ) ); return $activity_action; } add_filter( 'bp_activity_set_action', 'bpfr_hide_friends_activity_type_to_non_friends', 10, 2 ); ?>August 10, 2015 at 5:13 pm #242978In reply to: Hide friendshp in sitewide activity stream
danbp
Participanthere a complete solution you can use for friends privacy.
– Whe’re going to show the friends menu only to… friends !
– We remove friends activity.Copy this to bp-custom.php
function bpfr_maybe_hide_friends_nav_etc() { $retval = false; if ( bp_is_user() && ! bp_is_my_profile() && ! friends_check_friendship( bp_displayed_user_id(), bp_loggedin_user_id() ) ) { $retval = true; } return $retval; } function bpfr_hide_friends_nav_to_non_friends() { // Stop if condition is not filed if ( ! bpfr_maybe_hide_friends_nav_etc() ) { return; } // otherwise, we remove the nav bp_core_remove_nav_item( 'friends' ); // bp topnav bp_core_remove_subnav_item( 'activity', 'friends' ); //bp subnav (my activities, my groups, etc) } add_action( 'bp_ready', 'bpfr_hide_friends_nav_to_non_friends' ); // we want also to remove all friends related activities to non friends function bpfr_hide_friends_activity_type_to_non_friends( $activity_action = array(), $component_id = '' ) { // if condition is not filed we go back to original output if ( 'friends' != $component_id || ! bpfr_maybe_hide_friends_nav_etc() ) { return $activity_action; } // otherwise, we remove member from context $activity_action['context'] = array_diff( $activity_action['context'], array( 'member' ) ); return $activity_action; } add_filter( 'bp_activity_set_action', 'bpfr_hide_friends_activity_type_to_non_friends', 10, 2 );Related topic (other solution, or strict answer to your question) 😉
https://buddypress.org/support/topic/documentation-for-remove_action-activity-streams/#post-242974July 3, 2015 at 6:38 pm #241429In reply to: [Resolved] How to unset submenu tab
danbp
Participantfunction bpfr_remove_change_avatar_tab() { global $bp; bp_core_remove_subnav_item( 'profile', 'change-avatar' ); } add_action( 'bp_ready', 'bpfr_remove_change_avatar_tab', 15 );BuddyBar items
Source: bp-core-buddybar.php
function bp_core_remove_subnav_item( $parent_id, $slug )
and to remove a nav item
function bp_core_remove_nav_item( $parent_id )June 5, 2015 at 4:56 pm #240297Dono12
ParticipantI need some help. I’ve decided to remove the the messages->starred from BBP Activity and the Admin bar links.
I’ve tried a lot of functions and none of them seem to be working.four examples:
1. $bp->bp_nav[‘starred’] = false;
2. function remove_nav_items() {
bp_core_remove_nav_item( ‘starred’ );
}
add_action( ‘bp_setup_nav’, ‘remove_nav_items’);
// ——- End Removes Forum link Activity feed ————- //// ——- Removes member link forum AdminBar ————- //
3. $wp_admin_bar->remove_menu(‘starred’);
4. function the_bp_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( ‘my-account-starred’ );
}
add_action( ‘bp_setup_admin_bar’, ‘the_bp_admin_bar_remove’, 301 );I’ve done so successfully using CSS but I would like to use the functions instead. Can you please help?
li#starred-personal-li{
display:none;
}
li#wp-admin-bar-my-account-messages-starred{
display:none;
}April 13, 2015 at 12:38 pm #237813In reply to: how to hide a plugin generated buddypress tab
shanebp
ModeratorPlease do not double post.
try this:
function urbanfix_remove_nav_item() { if( current_user_cannot("access_s2member_level2") ) bp_core_remove_nav_item('listings'); } add_action( 'wp', 'urbanfix_remove_nav_item' );March 30, 2015 at 4:03 pm #236943In reply to: Remove 'Activity' item and content from profile page
danbp
ParticipantProfile default tab is member’s activity. You have to modify this first and assign another tab to default. For example, profile tab.
define('BP_DEFAULT_COMPONENT', 'profile' );Now you can use this to remove the activity tab. Note that the second if is related to visitor, you can remove it if you never want to show the activity tab.
function bpfr_hide_top_nav() { if( bp_is_active('xprofile' ) ) if( !is_user_logged_in() ) { bp_core_remove_nav_item( 'activity' ); } } add_action( 'bp_ready', 'bpfr_hide_top_nav' );March 14, 2015 at 12:21 pm #236006In reply to: Change Group Member Slug
MonkimoE
ParticipantHi.. thank you to keep guiding me.
I don’t know why those code for single groups page doesn’t working in my site.Then I tried to modify nav tab in single members page those can working good.
This what I have in bp-custom.php:<?php function edit_tabs_options() { global $bp; // MODIFY GROUP TABS $bp->bp_options_nav['groups']['home']['name'] = 'Group Activity'; //NOT WORK $bp->bp_nav['groups']['home']['name'] = 'Member Activity 2'; //NOT WORK //MODIFY MEMBERS TABS $bp->bp_nav['home']['name'] = 'Member Activity'; //IT'S WORK bp_core_remove_nav_item( 'forums' ); //IT'S WORK bp_core_remove_subnav_item( 'profile', 'change-avatar' ); //IT'S WORK } add_action( 'bp_setup_nav', 'edit_tabs_options' ); ?>Last try on fresh install wp + bp with default theme. I will let you know if those code works or not.
February 28, 2015 at 1:32 am #235262In reply to: Profile menu visibility
danbp
ParticipantAdd this to your child-theme functions.php or to bp-custom.php
Not sure it will work with your theme, and ‘activity’ tab seems now impossible to remove (since 2.2 at least). I don’t know why exactly. Uncomment both lines to see if it works for you.
function bpfr_hide_top_nav() { if( !is_user_logged_in() ) { // bp topnav items to hide // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); //bp subnav (my activities, my groups, etc) // bp_core_remove_subnav_item( 'activity', 'activity' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'groups' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); } } add_action( 'bp_ready', 'bpfr_hide_top_nav', 10 );February 3, 2015 at 10:29 pm #233523In reply to: How to make section of profile private?
Henry Wright
ModeratorYou could be right. I think
bp_core_remove_nav_item()might do a little more than just visually removing an item from the member’s nav menu.If it helps, this is the method that adds the item to the nav menu.
February 3, 2015 at 10:20 pm #233522In reply to: How to make section of profile private?
screampuff
ParticipantNo luck with
if ( bp_is_user() && bp_is_current_component( 'achievements' ) && bp_is_current_action( 'all' ) ) return;My guess is that since I removed the tab with
bp_core_remove_nav_item('achievements');that it is treating it like Buddypress is disabled like you mentioned above.February 3, 2015 at 9:14 pm #233515In reply to: How to make section of profile private?
screampuff
ParticipantThanks for the reply Henry.
I experimented with the code but couldn’t get it to work. I believe it has something to do with
if ( bp_current_action() != 'achievements' )I’m not sure if this is the best way to describe it, but when I previously used
bp_core_remove_nav_item('achievements');it made the /members/username/achievements outside of the buddpress page. It basically created a new page that had nothing but a list of the user’s achievements. The part it called from the plugin code. It doesn’t show the username, avatar or anything else from buddypress.Also thanks for that update Shane.
January 22, 2015 at 12:06 am #232723screampuff
ParticipantThanks for the reply. I made some changes to the code before reading and was able to accomplish removing the tab from buddypress profiles with this:
function hide_achievements_from_users() { global $bp; if ((bp_loggedin_user_id() == bp_displayed_user_id()) || (current_user_can('administrator'))){ return; } bp_core_remove_nav_item('achievements'); } add_action( 'bp_setup_nav', 'hide_achievements_from_users', 99 );However I’m stuck on how to 404 the pages if they manually type out the URL
In your code I see:
// I guess we should 404 this page because this member isn't an admin or the displayed member. $wp_query->set_404(); status_header( 404 ); nocache_headers();How do I get this to apply only when it is http://mysite.com/members/<username>/achievements?
January 21, 2015 at 5:54 pm #232682In reply to: Private Messaging 'Page Not Found' issue
kateleedotinfo
ParticipantI found the problem!!
For future users who might experience something like this:
I had modified the default members navigation options using bp_core_remove_nav_item(). One of the nav items I removed was messaging. I suppose removing the nav item somehow breaks the whole function. I had encountered a similar problem when I removed the ‘profile’ tab – it broke everything! Does anyone have any comments on ways to remove the nav options without breaking things? As of now, I’m using CSS display:none to hide the profile and messaging tabs.
January 10, 2015 at 2:11 am #231716In reply to: How To: change navigation?
eVersatile
Participant@henrywright
Thank you for your reply, though I am not quite understanding.
You linked forum mentions to insert the “define” commands into the wp-config.php file. It does ot mention where exactly to insert the settings. I played around with it though nothing happened.
bp_core_remove_nav_item() would go where? Do I add it as a general function?January 10, 2015 at 1:49 am #231715In reply to: How To: change navigation?
Henry Wright
ModeratorHi @eversatile
I have been trying to find the file location of the profile and group navigation menus, with no luck
There isn’t a template file which you can change if that’s what you mean, but…
I would like to change “forums” to “discuss” and remove the “members” from groups menu, etc
You can customise slugs quite easily. See the Customizable Slugs in BuddyPress article.
bp_core_remove_nav_item()will let you remove nav items from the navigation. There is alsobp_core_remove_subnav_item()for removing sub nav items.October 9, 2014 at 11:43 pm #208667Henry Wright
ModeratorYou can use
bp_core_remove_nav_item( $parent_id )to remove items from the navigation array.$parent_idis the slug of the parent navigation item. So, for example:function my_nav_item_removal_function() { bp_core_remove_nav_item( 'friends' ); } add_action( 'init', 'my_nav_item_removal_function' ); -
AuthorSearch Results