Search Results for 'bp_core_remove_nav_item'
-
AuthorSearch Results
-
March 30, 2015 at 4:03 pm #236943
In reply to: Remove 'Activity' item and content from profile page
danbpParticipantProfile 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
MonkimoEParticipantHi.. 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
danbpParticipantAdd 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 WrightModeratorYou 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?
screampuffParticipantNo 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?
screampuffParticipantThanks 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 #232723screampuffParticipantThanks 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
kateleedotinfoParticipantI 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?
eVersatileParticipant@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 WrightModeratorHi @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 WrightModeratorYou can use
bp_core_remove_nav_item( $parent_id )
to remove items from the navigation array.$parent_id
is 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' );
August 28, 2014 at 1:18 pm #188650In reply to: Remove menu tabs from BuddyPress Member Page
danbpParticipanthi @kostas-gogas,
try this:
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’,’your function’);action hook bp-core-dependency.php:104
Fire the ‘bp_ready’ action, which runs after BP is set up and the page is about to render.August 18, 2014 at 1:54 am #187100In reply to: Hide Profile Navigation from non-friends
danbpParticipantHi @dmccuiston,
here is another solution which let you remove easily nav and subnav items to any visitor and users who are not friends.
If one or all items are removed, a message is displayed.
Put these 3 functions in bp-custom.php or child-theme functions.php
function bpfr_view_profile_msg() { // msg in case the nav item is removed if ( bpfr_maybe_hide_friends_nav_etc( $retval ) ) echo'<h3>Sorry, you can only view the profile of your friends !</h3>'; } add_action( 'template_notices','bpfr_view_profile_msg' ); function bpfr_maybe_hide_friends_nav_etc() { $retval = false; // condition 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 ok if ( ! bpfr_maybe_hide_friends_nav_etc() ) { return; } // otherwise we remove the nav items // bp topnav items bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); //bp subnav items bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); } add_action( 'bp_ready', 'bpfr_hide_friends_nav_to_non_friends' );
June 2, 2014 at 9:51 am #183568In reply to: Notificatons only for admin visible
asianowlParticipanthere’s some clues:
First you need to check the user’s role/capabilities and then remove the navigation menu for these users. For me, I used:
if (current_user_can('none_admin_role')){bp_core_remove_nav_item( 'notifications');}} add_action( 'wp', 'bp_remove_nav_item' );
You then still need to remove it from the admin bar. My code:
function my_remove_admin_menu(){ global $wp_admin_bar; if (current_user_can('none_admin_role')) { $wp_admin_bar->remove_menu('notifications'); } } add_action('bp_setup_admin_bar', 'my_remove_admin_menu',301);
hopefully, this does the trick for you. I took me while to figure this out…goodluck.
March 22, 2014 at 10:51 am #180126In reply to: How I hide my un-wanted profile tabs
Henry WrightModeratorHi @sundev
Have you tried using
bp_core_remove_nav_item( 'slug' )
? There is also a function available in BP to remove sub-nav itemsbp_core_remove_subnav_item( 'slug', 'subnav-slug' )
November 28, 2013 at 8:03 pm #174945In reply to: [Resolved] Remove Activity tab from Groups
iheartwineParticipantI got rid the activity from the profile with this code:
function bphelp_remove_groups_from_profile(){ bp_core_remove_nav_item('activity'); } add_action('bp_activity_setup_nav','bphelp_remove_groups_from_profile');
but still looking for a solution to eliminate it from Group page
September 13, 2013 at 9:54 pm #171306In reply to: remove “activity” tab from user profile
bp-helpParticipantfunction bphelp_remove_activity_from_profile(){ bp_core_remove_nav_item('activity'); } add_action('bp_activity_setup_nav','bphelp_remove_activity_from_profile');
August 6, 2013 at 1:51 pm #169446IshannaParticipantHallo @sbrajesh !
I tried use code:
add_action(‘bp_friends_setup_nav’,'bpdev_custom_hide_friends_if_not_self’); function bpdev_custom_hide_friends_if_not_self(){ if(bp_is_my_profile()|| is_super_admin()) return ; bp_core_remove_nav_item(‘friends’); }
I copied and pasted the code into the ‘bp_custom.php’ file but it did not work for me.
I’m new to wordpress, html, php and css but I seem to find my way til now. Some advise please? I really need this option to work and I can’t find a plugin that cover this.Kind regards,
June 20, 2013 at 2:09 pm #166485In reply to: Im Multisite , Remove SITES Fields from Profile Nav
Brajesh SinghParticipantIf you guys mean the the sites from the navigation, then you can use the following code in either your theme’s functions.php or bp-custom.php
function bpdev_remove_blogs_nav(){ global $bp; bp_core_remove_nav_item($bp->blogs->id);// } add_action('wp_loaded','bpdev_remove_blogs_nav');
Hope that helps.
May 16, 2013 at 7:12 am #164055In reply to: Removing bp_nav menu item for specific users
Grant DerepasParticipantAchieved what I was after with the following code
function global_remove_media_tab() { global $bp; $profileid = bp_displayed_user_id(); $profiletype = xprofile_get_field_data( 'User Type', $profileid ); if ($profiletype == 'Groupie'){ bp_core_remove_nav_item('media'); } } add_action('bp_setup_nav','global_remove_media_tab');
May 16, 2013 at 4:28 am #164051In reply to: Removing bp_nav menu item for specific users
Grant DerepasParticipant//For own profile //First i need the logged in users id function global_remove_media_tab() { global $bp; $userid = bp_loggedin_user_id(); //Then use that ID to work out what type of user they are $usertype = xprofile_get_field_data( 'User Type', $userid ); if ($usertype == 'Groupie'){ bp_core_remove_nav_item('media'); } } add_action('bp_setup_nav','global_remove_media_tab');
Ok this code “works”.
But it removes the media tab for every profile when logged in as a “Groupie” User type.
What I want is to remove the tab from all Groupie Member profiles only including groupie members looking at their own profile.May 16, 2013 at 2:23 am #164048In reply to: Removing bp_nav menu item for specific users
Grant DerepasParticipant//For own profile //First i need the logged in users id global $bp; $userid = bp_loggedin_user_id(); //Then use that ID to work out what type of user they are $usertype = bp_profile_field_data( 'field=User Type&user_id=$userid' ); if ($usertype == 'type1'){ function remove_media_tab(){ bp_core_remove_nav_item('media'); } } add_action('bp_friends_setup_nav','remove_media_tab');
Ok updated that code and added it to my themes functions.php file.
Upon testing the code doesn’t seem to be doing anything. Logged in as specified user type and viewed my own profile as well as another member of that types profile and both are still showing the media tab.
Thoughts?
March 19, 2013 at 12:42 am #156742In reply to: Check if an user is or not a group_member :
daganreadParticipantI know this thread is 2 years old. But here’s my problem:
I would like to display different member profiles for different types of groups. I have 2 groups: faculty and contributor. More accurately i want to disable components like bp Links and group docs wiki for the faculty group; i settled for removing the links to such.
i thought the best approach would be to check if a member is of a certain group and then based on the conditional statement, remove the unnecessary tabs in the profile menu. If there is a better approach. Please lead the way:)
in my theme’s function.php:
`
if(groups_is_user_member( bp_loggedin_user_id(), BP_Groups_Group::get_id_from_slug(‘faculty’))){function setup_nav() {
global $bp;// Remove a menu item
bp_core_remove_nav_item( ‘messages’ );}
add_action( ‘bp_setup_nav’, ‘setup_nav’, 1000 );
}
`if i make the conditional statement truthy the appropriate tab is removed. If i stick the code in the if statement into something like header.php it works. BUT for some reason, together they do not.
Perhaps functions.php cannot reach such functions? I tried putting it into bp-custom.php, site just crashed.
Thank you for your time, any help would be appreciated 🙂
February 28, 2013 at 11:33 pm #154758Brajesh SinghParticipantYou Can put this code in your bp-custom.php and It will take care of your issue
`
add_action(‘bp_friends_setup_nav’,’bpdev_custom_hide_friends_if_not_self’);function bpdev_custom_hide_friends_if_not_self(){
if(bp_is_my_profile()|| is_super_admin())
return ;bp_core_remove_nav_item(‘friends’);
}
`
hope that helps.
October 18, 2012 at 3:34 pm #143662In reply to: Show nav items for profile users conditionally
modemlooperModeratorbp_core_remove_nav_item()
-
AuthorSearch Results