Search Results for 'bp_core_remove_nav_item'
-
AuthorSearch Results
-
September 6, 2016 at 11:16 am #258439
Topic: 404 error when “suppressing” the Activity tab
in group forum Installing BuddyPressjaumearagay
ParticipantHi there! 🙂
I want to suppress the whole Activity tab and Make the Profile the default tab. I’ve found code to do that but then I get a 404 error page when I click on a user’s link.
This is the code I’ve found:
/* *** */
/* Remove Activity tab from profile */
define( ‘BP_DEFAULT_COMPONENT’, ‘profile’ ); // Triem nova pestanya per defecte
function bphelp_remove_activity_from_profile(){
bp_core_remove_nav_item(‘activity’);
}
add_action(‘bp_activity_setup_nav’,’bphelp_remove_activity_from_profile’);/* *** */
Is there something wrong or missing?
Thanks in advance.
Jaume.
September 3, 2016 at 5:01 pm #258342In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantMy brilliant husband is my coder… He figured out how to define the default component, and saved the day. I hope this helps others.
define( 'BP_DEFAULT_COMPONENT', 'profile' ); function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'activity'); bp_core_remove_nav_item( 'notifications'); bp_core_remove_nav_item( 'messages' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'settings' ); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );September 1, 2016 at 1:16 am #258234In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantI also attempted to add them individually…
function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'notifications' ); bp_core_remove_nav_item( 'messages' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'settings' ); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );I’ve noticed some changes require us to repeat ourselves, while others allow us to list changes within one line of code. Haven’t deciphered this anomaly just yet.
September 1, 2016 at 1:02 am #258232In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantI placed the following code in the bp-custom.php which was found under the wp-content -> plugins.
function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'notifications', 'activity', 'groups', 'messages', 'forums', 'settings'); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );It breaks my site, shuts it down. From what I’ve read, I am supposed to specify what tab is open when opening a profile. Otherwise, browsers don’t know what to display since default is “Activity” and I’m removing it… Can someone please tell me where I went wrong? I appreciate the help!
August 26, 2016 at 6:57 pm #258094In reply to: New Privacy Plugin
danbp
Participanthi @fencer04,
thank for sharing your work. Well done, but it needs some revision (sorry).
At his activation on 2 test sites (one with 4.5.3/bp 2.6.1, other 4.6/bp2.6.2) i got a notice.
Array to string conversion inbuddypress/bp-core/classes/class-bp-core-nav.php on line 279fromsbpp04_privacy_check( ) ..\plugin.php:525 sbpp04_privacy_redirect( ) ..\buddypress-profile-privacy.php:176 bp_core_remove_nav_item( ) ..\buddypress-profile-privacy.php:184 BP_Core_Nav->delete_nav( ) ..\bp-core-buddybar.php:798Another point concerning UI/UX is the Private button appearing on buddybar.
On this tab, a default message says Friends Only.
USERNAME has chosen to limit profile access to friends only.
That’s wrong! Because this appear on each profile, even if the owner hasn’t setup anything about his profile privacy.So far i understand its fonctionality, this plugin let each member decide to show or not his whole profile page to friends or members only or to everyone (bp default).
– imo this tab should show “This profile is private” to anybody who is concerned by a privacy setting and should not appear at all if “Everyone” is set.
– the original BP Add as friend button on profile header or members directory is still there. This means that there is no need to go on Private tab to ask forfriendship.
This is a little confusing !If the plugin is to extend profile settings, it should appear in profile settings only. And as it doesn’t superseed BP, there is no real reason to give him an extra tab on buddybar outside of the settings scope. A template notice could be enough to tell visitors what’s going on on such a profile.
Just my 2 cents.
August 7, 2016 at 9:28 pm #257327In reply to: [Resolved] the right way to remove nav items
danbp
ParticipantHi,
two snippets to remove profile and group items.
function bpex_hide_profile_menu_tabs() { if( bp_is_active( 'xprofile' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { // BP's profile main menu items. Comment those to show. // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); // exist only if you use bbPress bp_core_remove_nav_item( 'forums' ); // BP's profile main menu items. Comment those to show. // bp_core_remove_subnav_item( 'activity', 'personnal' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 ); function bpex_remove_group_tabs() { if ( ! bp_is_group() ) { return; } $slug = bp_get_current_group_slug(); // hide items to all users except site admin if ( !is_super_admin() ) { // bp_core_remove_subnav_item( $slug, 'members' ); bp_core_remove_subnav_item( $slug, 'send-invites' ); // bp_core_remove_subnav_item( $slug, 'admin' ); // bp_core_remove_subnav_item( $slug, 'forum' ); } } add_action( 'bp_actions', 'bpex_remove_group_tabs' );August 7, 2016 at 12:03 am #257302Topic: [Resolved] the right way to remove nav items
in forum How-to & Troubleshootingwillenglishiv
Participanthowdy all
WP is 4.5.3
BP is 2.6.0I recently saw a warning about using $bp globally with the new version, and a small wiki on the new BP Navigation API
// add_action('bp_setup_nav', 'we4_profile_menu_tabs', 201); function we4_profile_menu_tabs(){ global $bp; $bp->bp_nav['activity']['position'] = 100; $bp->bp_nav['Photos']['position'] = 10; unset( $bp->bp_nav['groups'] ); unset( $bp->bp_nav['notifications'] ); unset( $bp->bp_nav['messages'] ); unset( $bp->bp_nav['settings'] ); }What I tried to do was remove groups, notifications, messages and settings from the nav bar but still have them work in other areas. I tried replacing the previous function with the following one:
add_action('bp_setup_nav', 'we4_profile_menu_tabs_two', 100 ); function we4_profile_menu_tabs_two(){ buddypress()->members->nav->edit_nav( array( 'position' => 100, ), 'activity' ); buddypress()->members->nav->edit_nav( array( 'position' => 1, ), 'photos' ); bp_core_remove_nav_item('groups'); bp_core_remove_nav_item('notifications'); bp_core_remove_nav_item('messages'); bp_core_remove_nav_item('settings'); }The research I saw said this was the right way to remove them, however in doing so, notifications and messages will return 404 pages. I ran into a similar problem trying to work on this last time.
Is there a correct way to remove the buttons without affecting other pages? doing groups in way #2 seems to be fine.
July 10, 2016 at 12:09 pm #256411In reply to: How to hide profile menu items from other users
danbp
ParticipantAdd this snippet to bp-custom.php and give it a try.
function bpex_hide_profile_menu_tabs() { if( bp_is_active( 'xprofile' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { // BP's profile main menu items. Comment those to show. // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); // exist only if you use bbPress bp_core_remove_nav_item( 'forums' ); // BP's profile main menu items. Comment those to show. // bp_core_remove_subnav_item( 'activity', 'personnal' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );July 6, 2016 at 10:48 am #256031In reply to: [Resolved] Removing nav & subnav item in groups
javierllinas
ParticipantHello,
Working perfect for subnav items, but not for main nav in my case. Can’t get this to work:
function my_remove_group_tab() { bp_core_remove_nav_item( 'send-invites', 'groups' ); } add_action( 'bp_actions', 'my_remove_group_tab', 9 );I don’t now what I’m missing here.
Appreciate any help.
June 27, 2016 at 9:00 am #255297In reply to: [Resolved] How to remove tabs from group admin nav
javierllinas
ParticipantThanks, @danbp!
You are right: only the fallback was working
bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );.
Adding the $component (which defaults to ‘members’) is the key:bp_core_remove_subnav_item( $parent_nav_slug, $tab, 'groups' );These functions are located in ‘bp-core/bp-core-buddybar.php’.
I’d also want to get rid of ‘send-invites’ in group primary navigation, but this is not working for me:bp_core_remove_nav_item( 'send-invites', 'groups' );Thank you,
JavierJune 24, 2016 at 7:03 am #255125sharmavishal
Participanttry this and let me know if it works in bp 2.6 for u or not
function my_remove_em_nav() { global $bp; bp_core_remove_nav_item( 'events' ); bp_core_remove_subnav_item( 'settings', 'profile' ); } add_action( 'bp_init', 'my_remove_em_nav' );June 16, 2016 at 6:32 pm #254694In 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');March 29, 2016 at 11:56 am #251893Topic: remove “view” link in nav menu
in forum How-to & Troubleshootinggiilour
ParticipantI want to be able to remove the “view” link in nav menu for subscribers or get rid of all menu items for subscribers.
I have been able to get rid of some of the menu items with
function bpview_hide_top_nav() {
if( bp_is_active(‘xprofile’ ) )
if( bp_loggedin_user_id() == bp_displayed_user_id() ) {
bp_core_remove_nav_item( ‘profile’ );
bp_core_remove_nav_item( ‘view’ );
}
}
add_action( ‘bp_ready’, ‘bpview_hide_top_nav’ );January 25, 2016 at 11:17 am #249094Topic: Remove post-form
in forum How-to & TroubleshootingUrbanFix
ParticipantHi, I am using s2member and would like to remove the activity post form from the sitewide activity page using s2member conditionals.
I am unsure what the best way to go about this would be.
I have looked at activity/post-form and /bp-acti….template but im unsure where to add the if statement!I am removing the bp activity tab (and another one) using:
<?php function uf_remove_nav_item() { if( current_user_cannot("access_s2member_level2") ) bp_core_remove_nav_item('activity'); if( current_user_cannot("access_s2member_level2") ) bp_core_remove_nav_item('listings'); } add_action( 'wp', 'uf_remove_nav_item' ); ?>Any advice would be great,
Thanks,
UFDecember 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 12, 2015 at 11:31 am #246652Topic: Remove ‘Send Invites’ from Members profile tab – only on group
in group forum Third Party Pluginsstartershut
ParticipantHi,
I am looking to remove the ‘Send Invites’ tab from my Members view and only have it as a sub tab under Groups.
How do I remove it? I tried the below.
function startershut_remove_bp_nav() {
bp_core_remove_nav_item( ‘friends’ );
bp_core_remove_nav_item(‘send-invites’);}
But that has not worked.
Any thoughts.
Thanks
TroyNovember 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 23, 2015 at 6:51 pm #243508Topic: bp_core_remove_nav_item
in forum How-to & Troubleshootingmuskokee
ParticipantHi everyone, using this function (in the subject line) doesn’t just remove the item from the navigation menu, it removes it from the entire functionality of BuddyPress as this previous poster found:
https://buddypress.org/support/topic/removing-nav-item-prevents-access-to-corresponding-page/
Holy moly! I just wanted to redesign the layout of the links! Is there a way to *just* remove the navigation item without removing the functionality? I still want to use messages…just want to reposition it on the page!
Thanks
SheriAugust 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 ); ?> -
AuthorSearch Results