Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'add profile tab to nav bar'

Viewing 25 results - 1 through 25 (of 53 total)
  • Author
    Search Results
  • #331806
    chrishechler
    Participant

    Hi,

    is there any chance to transform/change the regular filter dropdown options (recently active, newest members and alphabetical) to buttons that sit next to each other?
    I have achieved to make the dropdown into buttons, but the logic and filtering functionality are gone.

    This is teh directory template where I replaced the dropdown:

    <?php
    /**
    * BuddyPress Members Directory
    *
    * @version 3.0.0
    */
    ?>

    <?php
    /**
    * Fires at the beginning of the templates BP injected content.
    *
    * @since BuddyPress 2.3.0
    */
    do_action( ‘bp_before_directory_members_page’ );
    ?>

    <div class=”members-directory-wrapper”>

    <?php
    /**
    * Fires before the display of the members.
    *
    * @since BuddyPress 1.1.0
    */
    do_action( ‘bp_before_directory_members’ );
    ?>

    <div class=”members-directory-container”>

    <?php if ( function_exists( ‘bp_disable_advanced_profile_search’ ) && bp_disable_advanced_profile_search() ) { ?>
    <div class=”subnav-search members-search”>
    <?php bp_nouveau_search_form(); ?>
    </div>
    <?php } ?>

    <?php
    /**
    * Fires before the display of the members list tabs.
    *
    * @since BuddyPress 1.8.0
    */
    do_action( ‘bp_before_directory_members_tabs’ );
    ?>

    <?php if ( ! bp_nouveau_is_object_nav_in_sidebar() ) : ?>

    <?php bp_get_template_part( ‘common/nav/directory-nav’ ); ?>

    <?php endif; ?>

    <?php
    /**
    * Fires before the display of the members content.
    *
    * @since BuddyPress 1.1.0
    */
    do_action( ‘bp_before_directory_members_content’ );
    ?>

    <div class=”flex bp-secondary-header align-items-center”>
    <div class=”push-right flex”>
    <div class=”bp-profile-filter-wrap subnav-filters filters no-ajax”>
    <!– Replace the dropdown filters with buttons –>
    <button class=”filter-button” data-filter=”recently-active”>Recently Active</button>
    <button class=”filter-button” data-filter=”newest-members”>Newest Members</button>
    <button class=”filter-button” data-filter=”alphabetically”>Alphabetically</button>
    <!– Add more buttons for other filter options as needed –>
    </div>
    <div class=”bp-members-filter-wrap subnav-filters filters no-ajax”>
    <!– You can add more buttons here if needed –>
    </div>

    <?php bp_get_template_part( ‘common/filters/grid-filters’ ); ?>
    </div>
    </div>

    <div class=”screen-content members-directory-content”>

    <div id=”members-dir-list” class=”members dir-list” data-bp-list=”members”>
    <div id=”bp-ajax-loader”><?php bp_nouveau_user_feedback( ‘directory-members-loading’ ); ?></div>
    </div><!– #members-dir-list –>

    <?php
    /**
    * Fires and displays the members content.
    *
    * @since BuddyPress 1.1.0
    */
    do_action( ‘bp_directory_members_content’ );
    ?>
    </div><!– // .screen-content –>

    <?php
    /**
    * Fires after the display of the members content.
    *
    * @since BuddyPress 1.1.0
    */
    do_action( ‘bp_after_directory_members_content’ );
    ?>

    </div>

    <?php
    /**
    * Fires after the display of the members.
    *
    * @since BuddyPress 1.1.0
    */
    do_action( ‘bp_after_directory_members’ );
    ?>

    </div>

    <?php
    /**
    * Fires at the bottom of the members directory template file.
    *
    * @since BuddyPress 1.5.0
    */
    do_action( ‘bp_after_directory_members_page’ );
    ?>

    #326158
    helbnt
    Participant

    Howdy,

    I’ve created a profile drop down menu using the items available in the BuddyPress Member section under the Add Menu Items in my navbar. I’m using the Understrap child theme, which has one primary menu location.

    In Firefox, this works as expected. The “Profile” menu option is there, with the downward pointing arrow. In Chrome and Safari, however, it just says “Profile”, with no arrow to indicate a drop down menu is available. Clicking “Profile” itself yields no results.

    I’ve tried switching themes, using the twenty twenty one theme, but the same issue persists.

    If I add pages to the menu, and nest pages under that, everything works as expected, in Chrome, Safari, and Firefox. Drop down works just fine.

    In Chrome’s Developer Console, on the Network Tab, nothing seems amiss, Status 200 down the line.

    Kinda at a loss. Any suggestions?

    Thanks.

    #319108
    gshore1518
    Participant

    I am trying to find a way to add a profile page specific to the user that is logged in which will live in the navbar. Has anyone done this previously?

    nffox
    Participant

    One question. I’m trying to remove some menu items, but it only works if I add 2 different codes to functions.php and bp-custom.php.

    This one goes to functions.php

    function exclude_tab_if_not_personal_profile() {
        if ( ! bp_is_my_profile() ) {
            bp_core_remove_nav_item( 'friends' );
        }
    }
    add_action( 'bp_init', 'exclude_tab_if_not_personal_profile' );

    And this one to bp-custom.php

    function bp_remove_nav_item() {
        global $bp;
        bp_core_remove_subnav_item( $bp->profile->friends, 'change-avatar' );
    }
    add_action( 'wp', 'bp_remove_nav_item' );

    >>>>>>>>>>>>>>>
    It works… but

    1. The “friends” tabs appears in the profile (top navbar), and I just need it to appear in the profile menu (sidebar).

    2. Adding this piece of code for removing MORE items do nothing.
    The combination I used for bp-custom.php.

    function bp_remove_nav_item() {
        global $bp;
        bp_core_remove_subnav_item( $bp->profile->friends, 'change-avatar' );
        bp_core_remove_subnav_item( $bp->profile->forums, 'change-avatar' );
        bp_core_remove_subnav_item( $bp->profile->media, 'change-avatar' );
    }
    add_action( 'wp', 'bp_remove_nav_item' );

    and for functions.php

    function exclude_tab_if_not_personal_profile() {
        if ( ! bp_is_my_profile() ) {
            bp_core_remove_nav_item( 'friends' );
            bp_core_remove_nav_item( 'forums' );
            bp_core_remove_nav_item( 'media' );
        }
    }
    add_action( 'bp_init', 'exclude_tab_if_not_personal_profile' );

    Thanks, I would really appreciate any help, as apparently none of solutions found on this forum worked for me.

    #311769
    bluesweet
    Participant

    I found this snippet that will remove certain tabs but it also removes the tab from the drop-down menu too. How can I just hide tabs that I don’t want the users to see on the profile page nav bar? I still want them to be seen in the dropdown menu.

    /**
    * Removing the friends tab
    */
    function mb_profile_menu_tabs(){

    global $bp;

    bp_core_remove_nav_item(‘friends’);

    }
    add_action(‘bp_setup_nav’, ‘mb_profile_menu_tabs’, 201);
    /**

    * Removing the friends tab
    */

    #309830
    bmcconach
    Participant

    Howdy, BuddyPress friends!

    I have been working on a project for fun and have been enjoying the laying out of items and adding plugin functionality a bit much here lately. So much so, in fact, that I put the testing phase on the back shelf for a bit.

    When I was attempting to request membership from a test account to a private group that my admin account was the creator of, I ran into an issue: I can get to the request page (/groups/test-group/request-membership/?_wpnonce=47febc75fe) by clicking the link to do so and then am presented with a textarea for request comments, however when I submit the form (with or without comments) I am taken back to the group’s main page (/groups/test-group/) and am presented with “There was an error sending your group membership request. Please try again.” The request does not come through (not in BP’s notifications, e-mail, pending requests, etc.) at all.

    At first this was a minor irritation because I could go to the group as the admin and invite the test account to join the group. There I am presented with a checkbox for my test account’s name, as well as a submit button; however when clicking on the checkbox, the form instantly submits without ever sending an invite. I even attempted to modify the live source to set the field to checked, attempted to submit, and received a success message stating my invite was sent, but of course it never was.

    I have checked the list of plugins I have on my site, disabled a few I didn’t necessarily need, and have checked each of the remaining to see if there’s any sort of conflict between plugins affecting groups, but to no avail. This functionality is key to the use of groups for my project, so I would sincerely appreciate any advice from more knowledgeable members of the BP community.

    Some support information, including a list of active plugins, can be found below. Please note that any plugin with ** beside it came bundled with the theme.

    == Server Environment ==
    	Operating System: Linux
    	Software: Apache/2.4.6
    	MySQL version: MariaDB Server v5.5.61-MariaDB-38.13
    	PHP Version: 7.2.24
    	PHP Max Input Vars: 2500
    	PHP Max Post Size: 64M
    	GD Installed: Yes
    	ZIP Installed: Yes
    	Write Permissions: All right
    	Elementor Library: Connected
    
    == WordPress Environment ==
    	Version: 5.3.2
    	WP Multisite: No
    	Max Upload Size: 64 MB
    	Memory limit: 512M
    	Permalink Structure: /%postname%/
    	Language: en-US
    	Timezone: America/New_York
    	Debug Mode: Inactive
    
    == Theme ==
    	Name: Gwangi
    	Version: 2.1.1
    	Author: Themosaurus
    	Child Theme: No
    
    == User ==
    	Role: administrator
    	WP Profile lang: en_US
    	User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
    
    == Active Plugins ==
    	(BuddyDev) BP Auto Login on Activation
    		Version: 1.0.3
    		Author: Brajesh Singh
    
    	Author Avatars List**
    		Version: 1.18
    		Author: Paul Bearne
    
    	Awesome Weather Widget
    		Version: 3.0.2
    		Author: Hal Gatewood
    
    	bbPress
    		Version: 2.6.3
    		Author: The bbPress Contributors
    
    	BP Messages Tool
    		Version: 2.1
    		Author: PhiloPress
    
    	BP Profile Search
    		Version: 5.2.4
    		Author: Andrea Tarantini
    
    	BuddyPress
    		Version: 5.1.2
    		Author: The BuddyPress Community
    
    	BuddyPress Default Cover Photo
    		Version: 1.6.0
    		Author: SeventhQueen
    
    	BuddyPress Extended Friendship Request
    		Version: 1.2.0
    		Author: BuddyDev Team
    
    	BuddyPress Reorder Tabs
    		Version: 2.0.1
    		Author: BuddyBoss
    
    	BuddyPress Xprofile Custom Field Types
    		Version: 1.1.3
    		Author: BuddyDev
    
    	Classic Editor
    		Version: 1.5
    		Author: WordPress Contributors
    
    	Classic Editor Addon
    		Version: 2.6.0
    		Author: Pieter Bos, Greg Schoppe
    
    	Dashboard Notepad
    		Version: 1.42
    		Author: Stephanie Leary
    
    	Easy Custom Sidebars**
    		Version: 1.0.10
    		Author: Titanium Themes
    
    	Elementor**
    		Version: 2.8.3
    		Author: Elementor.com
    
    	Envato Market
    		Version: 2.0.3
    		Author: Envato
    
    	Essential Addons for Elementor
    		Version: 3.7.1
    		Author: WPDeveloper
    
    	Grimlock**
    		Version: 1.2.5
    		Author: Themosaurus
    
    	Grimlock Animate**
    		Version: 1.1.0
    		Author: Themosaurus
    
    	Grimlock for Author Avatars List**
    		Version: 1.0.4
    		Author: Themosaurus
    
    	Grimlock for bbPress**
    		Version: 1.0.3
    		Author: Themosaurus
    
    	Grimlock for BuddyPress**
    		Version: 1.1.4
    		Author: Themosaurus
    
    	Grimlock for Elementor**
    		Version: 1.0.1
    		Author: Themosaurus
    
    	Grimlock for Jetpack**
    		Version: 1.0.4
    		Author: Themosaurus
    
    	Grimlock for Testimonials by WooThemes**
    		Version: 1.1.0
    		Author: Themosaurus
    
    	Grimlock for The Events Calendar**
    		Version: 1.1.2
    		Author: Themosaurus
    
    	Grimlock Hero**
    		Version: 1.0.7
    		Author: Themosaurus
    
    	Grimlock Isotope**
    		Version: 1.0.7
    		Author: Themosaurus
    
    	Grimlock Login**
    		Version: 1.0.10
    		Author: Themosaurus
    
    	Hide Admin Bar
    		Version: 0.3.9.9
    		Author: Shelby DeNike
    
    	If Menu - Visibility control for menu items
    		Version: 0.15
    		Author: Layered
    
    	Kirki Customizer Framework**
    		Version: 3.0.45
    		Author: Ari Stathopoulos
    
    	MediaPress
    		Version: 1.4.6
    		Author: BuddyDev
    
    	Menu Image**
    		Version: 2.9.5
    		Author: Rui Guerreiro
    
    	Simple Buddypress Profile Privacy
    		Version: 0.7.9
    		Author: Justin Hansen
    
    	Social Articles
    		Version: 2.9.5
    		Author: Broobe
    
    	The Events Calendar
    		Version: 4.9.14
    		Author: Modern Tribe, Inc.
    
    	UpdraftPlus - Backup/Restore
    		Version: 1.16.21
    		Author: UpdraftPlus.Com, DavidAnderson
    
    	Verified Member for BuddyPress**
    		Version: 1.1.1
    		Author: Themosaurus
    
    == Must-Use Plugins ==
    	Gateway Relay
    		Version: 1.0
    		Author: Arnold Bailey (Incsub)
    
    	rms_unique_wp_mu_pl_fl_nm.php
    		Version: 
    		Author: 
    
    	WPMU Assist
    		Version: 1.0.2
    		Author: Arnold Bailey (Incsub)
    
    == Elements Usage ==
    	
    	wp-page : 12
    		eael-adv-tabs : 1
    		google_maps : 1
    		image-carousel : 1
    		shortcode : 1
    		text-editor : 1
    		wp-widget-grimlock_author_avatars_section_widget : 1
    		wp-widget-grimlock_posts_section_widget : 1
    		wp-widget-grimlock_query_section_widget : 1
    		wp-widget-grimlock_section_widget : 3
    		wp-widget-grimlock_the_events_calendar_tribe_events_section_widget : 1
    
    == Log ==
    	
    PHP: showing 1 of 1PHP: 2020-01-02 10:43:38 [error X 1][/home/*****/public_html/wp-content/plugins/elementor/elementor.php::97] Cannot redeclare elementor_fail_wp_version() (previously declared in /home/*****/public_html/wp-content/plugins/elementor/elementor.php:97) [array (
      'trace' => '
    #0: Elementor\Core\Logger\Manager -> shutdown()
    ',
    )]
    
    JS: showing 1 of 1JS: 2020-01-11 16:50:05 [error X 1][https://*****/wp-content/plugins/grimlock/assets/js/navigation-stick-to-top.js?ver=1.2.5:27:45] Cannot read property \'top\' of undefined
    Venutius
    Moderator

    This one is not that straight-forward there is a filter you can use as follows:

    function bpex_role_disable_avatar_uploads( $default ) {
    	
    	$user = wp_get_current_user();
    	$user_roles_array = $user->roles ? $user->roles : array();
    	
    		foreach ( $user_roles_array as $key => $role ) {
    			if ( $role == 'subscriber' ) {
    				$default = true;
    			}
    		}
    		
    		return $default;
    	
    }
    
    add_filter( 'bp_disable_avatar_uploads', 'bpex_role_disable_avatar_uploads' );

    However this causes BuddyPress to simply show the user that they can upload their profile image via gravatar, and I’m afraid you can’t switch this off.

    So the alternative is to remove the Change Photo tab and admin-bar menu item:

    add_action( 'bp_setup_nav', 'bpex_remove_change_profile_photo_tab', 50 );
    add_action( 'bp_setup_admin_bar', 'bpex_admin_bar_remove_change_profile_photo', 50 );
    
    function bpex_remove_change_profile_photo_tab() {
    	
    	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() && bp_displayed_user_id() != wp_get_current_user() ) {
    		return;
    	}
    	
    	$user = wp_get_current_user();
    	$user_roles_array = $user->roles ? $user->roles : array();
    	
    	foreach ( $user_roles_array as $key => $role ) {
    		if ( $role == 'subscriber' ) {
    			bp_core_remove_subnav_item( 'profile', 'change-avatar' );
    		}
    	}
    
    }
    
    function bpex_admin_bar_remove_change_profile_photo() {
    	
    	global $wp_admin_bar, $bp;
    
    	if ( ! bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) {
    		return false;
    	}
    
    	$user_id = get_current_user_id();
    	
    	if ( ! $user_id || $user_id == 0 || ! is_numeric( $user_id ) ) {
    		return;
    	}
    	
    	$user = wp_get_current_user();
    	$user_roles_array = $user->roles ? $user->roles : array();
    	
    	foreach ( $user_roles_array as $key => $role ) {
    		if ( $role == 'subscriber' ) {
    			$wp_admin_bar->remove_menu( 'my-account-xprofile-change-avatar', 'my-account-xprrofile' );
    		}
    	}
    
    }

    You’d need to put this in your child themes functions.php or a bp-custom.php file in the plugins directory.

    #304339
    Venutius
    Moderator

    Hi there,

    My suggestion is that you add a new menu item “All” and create a new set of queries for the page then make that page the default landing page for the profile activity page. Here’s my code to do this:

    function bpex_set_member_default_nav() {
     
    		if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		    return;
    	         }
    
                    bp_core_new_nav_default(
    		array(
    			'parent_slug'       => buddypress()->activity->id,
    		// other "activity" sub_nav slugs : personal favorites friends groups mentons
    			'subnav_slug'       => 'all-activity',
    			'screen_function'   => 'bp_activity_screen_all_activity'
    		)
    	);
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );
    
    add_action( 'bp_setup_nav', 'bpex_just_me_tab', 50 );
    add_action( 'bp_setup_admin_bar', 'bpex_admin_bar_add', 50 );
    
    function bpex_just_me_tab() {
    	
    	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		return;
    	}
    	
    	global $bp;
    	$user_id = bp_displayed_user_id();
    	
    		bp_core_new_subnav_item( array(
    			'name'            => _x( 'All', 'Profile activity screen sub nav', 'buddypress' ),
    			'slug'            => 'all-activity',
    			'parent_url'      => bp_core_get_user_domain( $user_id ) . 'activity/',
    			'parent_slug'     => 'activity',
    			'screen_function' => 'bp_activity_screen_all_activity',
    			'position'        => 10
    		) );
    
    }
    
    function bpex_admin_bar_add() {
    	
    	global $wp_admin_bar, $bp;
    
    	if ( ! bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) {
    		return false;
    	}
    
    	$user_id = get_current_user_id();
    	
    	if ( ! $user_id || $user_id == 0 || ! is_numeric( $user_id ) ) {
    		return;
    	}
    	
    	// Personal.
    	//$wp_admin_bar->remove_menu( 'my-account-activity-personal', 'my-account-activity' );
    
    	$wp_admin_bar->add_menu( array(
    		'parent'   => 'my-account-activity',
    		'id'       => 'my-account-activity-all-activity',
    		'title'    => 'All',
    		'href'     => bp_core_get_user_domain( $user_id ) . 'activity/all-activity/',
    		'position' => 10
    	) );
    }
    function bp_activity_screen_all_activity() {
    
    	do_action( 'bp_activity_screen_all_activity' );
    
    	bp_core_load_template( apply_filters( 'bp_activity_template_all_activity', 'members/single/home' ) );
    }
    
    function bp_activity_filter_all_activity_scope( $retval = array(), $filter = array() ) {
    
    	// Determine the user_id.
    	if ( ! empty( $filter['user_id'] ) ) {
    		$user_id = $filter['user_id'];
    	} else {
    		$user_id = bp_displayed_user_id()
    			? bp_displayed_user_id()
    			: bp_loggedin_user_id();
    	}
    
    	// Should we show all items regardless of sitewide visibility?
    	$show_hidden = array();
    	if ( ! empty( $user_id ) && $user_id !== bp_loggedin_user_id() ) {
    		$show_hidden = array(
    			'column' => 'hide_sitewide',
    			'value'  => 0
    		);
    	}
    
    	// Determine groups of user.
    	$groups = groups_get_user_groups( $user_id );
    	if ( empty( $groups['groups'] ) ) {
    		$groups = array( 'groups' => 0 );
    	}
    
    	// Determine the favorites.
    	$favs = bp_activity_get_user_favorites( $user_id );
    	if ( empty( $favs ) ) {
    		$favs = array( 0 );
    	}
    
    	// Determine friends of user.
    	$friends = friends_get_friend_user_ids( $user_id );
    	if ( empty( $friends ) ) {
    		$friends = array( 0 );
    	}
    
    	$retval = array(
    		'relation' => 'OR',
    		array(
    			'relation' => 'AND',
    			array(
    				'column'  => 'user_id',
    				'compare' => 'IN',
    				'value'   => (array) $friends
    			)
    		),
    		array(
    			'relation' => 'AND',
    			array(
    				'column' => 'component',
    				'value'  => buddypress()->groups->id
    			),
    			array(
    				'column'  => 'item_id',
    				'compare' => 'IN',
    				'value'   => (array) $groups['groups']
    			)
    		),
    		array(
    			'relation' => 'AND',
    			array(
    				'column' => 'user_id',
    				'value'  => $user_id
    			)
    		),
    		array(
    			'relation' => 'AND',
    			array(
    				'column'  => 'id',
    				'compare' => 'IN',
    				'value'   => (array) $favs
    			)
    		),
    		array(
    			'relation' => 'AND',
    			array(
    				'column'  => 'content',
    				'compare' => 'LIKE',
    
    				// Start search at @ symbol and stop search at closing tag delimiter.
    				'value'   => '@' . bp_activity_get_user_mentionname( $user_id ) . '<'
    			)
    		),
    		// We should only be able to view sitewide activity content for friends.
    		array(
    			'column' => 'hide_sitewide',
    			'value'  => 0
    		),
    
    		// Overrides.
    		'override' => array(
    			'filter'      => array( 'user_id' => 0 ),
    			'show_hidden' => true
    		),
    	);
    	
    
    	return $retval;
    }
    add_filter( 'bp_activity_set_all-activity_scope_args', 'bp_activity_filter_all_activity_scope', 10, 2 );

    Once you have done that you would also want to overload the buddypress/bp-templates/your-template/members/single/activity.php to make sure this new page contains the post update form:

    Change:

    if ( is_user_logged_in() && bp_is_my_profile() && ( !bp_current_action() || bp_is_current_action( 'just-me' ) ) )
    	bp_get_template_part( 'activity/post-form' );

    To:

    if ( is_user_logged_in() && bp_is_my_profile() && ( !bp_current_action() || bp_is_current_action( 'all-activity' ) ) )
    	bp_get_template_part( 'activity/post-form' );
    

    Note: with this method there is a danger of duplicating activity since a friend posting to a group would show up in the groups search as well as the friends search etc. so you may want to adjust the $retval criteria.

    Also you might want to add a post form for visiting users so they can leave a comment for the user, you could ad this:

    function bpex_load_mention_me() {
    	
    	if ( get_current_user_id() != bp_displayed_user_id() ) {
    		$_GET['r'] = bp_activity_get_user_mentionname( bp_displayed_user_id() );
    		bp_get_template_part( 'activity/post-form' );
    	}
    
    }
    
    add_action( 'bp_before_member_body', 'bpex_load_mention_me' );
    #304326

    In reply to: Activity default tab

    Venutius
    Moderator

    Hey, it looks like I gave up just a tad early. I think I’ve got it working now:

    function bpex_set_member_default_nav() {
     
        	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		return;
    	}
            
            if ( bp_displayed_user_id() == get_current_user_id() ) {
            
            bp_core_new_nav_default(
                array(
                    'parent_slug'       => buddypress()->activity->id,
    	        // other "activity" sub_nav slugs : personal favorites friends groups mentons
                    'subnav_slug'       => 'friends',
                    'screen_function'   => 'bp_activity_screen_friends'
                )
            );
        }
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );
    
    add_action( 'bp_setup_nav', 'bpex_just_me_tab', 50 );
    add_action( 'bp_setup_admin_bar', 'bpex_admin_bar_add', 50 );
    
    function bpex_just_me_tab() {
    	
    	if ( ! bp_is_user_profile() && ! bp_is_user_activity() && ! bp_is_user() ) {
    		return;
    	}
    	
    	global $bp;
    	$is_own_view = false;
    	$user_id = bp_displayed_user_id();
    	
    	if ( get_current_user_id() == $user_id ) $is_own_view = true;
    	
    
    	if ( $is_own_view ) {
    
    		bp_core_remove_subnav_item( 'activity', 'just_me');
    
    		bp_core_new_subnav_item( array(
    			'name'            => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ),
    			'slug'            => 'just-me',
    			'parent_url'      => bp_core_get_user_domain( $user_id ) . 'activity/',
    			'parent_slug'     => 'activity',
    			'screen_function' => 'bp_activity_screen_my_activity',
    			'position'        => 10
    		) );
    	}
    
    }
    
    function bpex_admin_bar_add() {
    	
    	global $wp_admin_bar, $bp;
    
    	if ( ! bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) {
    		return false;
    	}
    
    	$user_id = get_current_user_id();
    	
    	if ( ! $user_id || $user_id == 0 || ! is_numeric( $user_id ) ) {
    		return;
    	}
    	
    	// Personal.
    	$wp_admin_bar->remove_menu( 'my-account-activity-personal', 'my-account-activity' );
    
    	$wp_admin_bar->add_menu( array(
    		'parent'   => 'my-account-activity',
    		'id'       => 'my-account-activity-personal',
    		'title'    => 'Personal',
    		'href'     => bp_core_get_user_domain( $user_id ) . 'activity/180/',
    		'position' => 10
    	) );
    }
    

    Give it a try

    Venutius
    Moderator

    Here’s how to remove forums from all users profile tabs and toolbar menu, this code would need to go in your child-themes functions.php:

    function venutius_remove_forums_on_usermenu() {
    global $wp_admin_bar;
    
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-forums' );
    	}
    
    }
    add_action( 'wp_before_admin_bar_render', 'venutius_remove_forums_on_usermenu' );
    
    function venutius_remove_profile_forums_tab() {
    
    	bp_core_remove_nav_item( 'forums' );
    
    }
    add_action( 'bp_actions', 'venutius_remove_profile_forums_tab' );
    #303515

    In reply to: Email Tab hide/remove

    Venutius
    Moderator

    I think you should be able to do something like this:

    function bpex_remove_email_item_on_usermenu() {
    global $wp_admin_bar;
    
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-settings-notifications' );
    	}
    
    }
    add_action( 'wp_before_admin_bar_render', 'bpex_remove_email_item_on_usermenu' );
    
    function bpex_remove_profile_settings_email_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :	
    
    		bp_core_remove_subnav_item( 'settings', 'notifications' );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_remove_profile_settings_email_tab' );
    kenmcall
    Participant

    Greetings,

    We are using LDAP to populate and maintain our Buddypress members list, and because of this we don’t want people to be able to change their password or email address via the Settings > General tab. We would like to therefore hide the General tab and have Settings redirect to a different tab instead (preferably Settings > Profile)

    I have gone through the forums and have viewed other posts by people dealing with the same issue, specifically this one:

    How to hide / remove the General tab under Settings

    Here’s the code:

    function bpex_change_profile_settings_default_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :
    
    	$access        = bp_core_can_edit_settings();
    	$slug          = bp_get_settings_slug();
    
    	$args = array(
    		'parent_slug'     => $slug,
    		'subnav_slug'	  => 'notifications',
    		'screen_function' => 'bp_settings_screen_notification',
    		'user_has_access' => $access
    		);
     
    	bp_core_new_nav_default( $args );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_change_profile_settings_default_tab' );
    
    function bpex_remove_general_item_on_usermenu() {
    global $wp_admin_bar;
    
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-settings-general' );
    	}
    
    }
    add_action( 'wp_before_admin_bar_render', 'bpex_remove_general_item_on_usermenu' );
    
    function bpex_remove_profile_settings_general_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :	
    
    		bp_core_remove_subnav_item( 'settings', 'general' );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_remove_profile_settings_general_tab' );

    This seems to be the solution I need, but when I add the code to bp-custom.php it does remove the General tab, but now clicking on Settings generates a 404 error. As this post is over a year old, I’m wondering if there have been changes to Buddypress that stops this from working.

    I should mention that I’ve done some (but not a lot) of PHP programming. I did have a co-oworker who is quite proficient at PHP look over this with me, but everything we tried failed to work.

    Thanks for any help anyone can give.

    lz430
    Participant

    Hey everyone,
    I have a membership site. It’s running Woocommerce, WP 4.9.6 and Buddypress 3.0.0. My BuddyPress status is below.

    I’m having a problem when someone is choosing a any kind of membership(I only have free and 1 paid at the moment). When they get to the billing screen they can either use Facebook or Google to login and fill in the details.

    Once they do that, Buddypress redirects them to their wall. I want them to be able to continue the checkout process. I’ve tried so many things, but can’t override it.

    Please help!

    
    ### WordPress Environment ###
    
    Home URL: http://www.specialtactics.global
    Site URL: http://www.specialtactics.global
    WC Version: 3.4.1
    Log Directory Writable: ✔
    WP Version: 4.9.6
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.1.16 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
    PHP Post Max Size: 128 MB
    PHP Time Limit: 3000
    PHP Max Input Vars: 1000
    cURL Version: 7.54.0
    OpenSSL/1.0.2k
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.39-cll-lve
    Max Upload Size: 128 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.4.1
    WC Database Prefix: wp_
    MaxMind GeoIP Database: ✔
    Total Database Size: 11.24MB
    Database Data Size: 10.10MB
    Database Index Size: 1.14MB
    wp_woocommerce_sessions: Data: 0.04MB + Index: 0.00MB
    wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_order_itemmeta: Data: 0.00MB + Index: 0.01MB
    wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB
    wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB
    ts_redirects: Data: 0.00MB + Index: 0.00MB
    wp_achievements: Data: 0.02MB + Index: 0.01MB
    wp_bp_activity: Data: 0.01MB + Index: 0.01MB
    wp_bp_activity_meta: Data: 0.00MB + Index: 0.01MB
    wp_bp_friends: Data: 0.00MB + Index: 0.00MB
    wp_bp_groups: Data: 0.00MB + Index: 0.00MB
    wp_bp_groups_groupmeta: Data: 0.00MB + Index: 0.00MB
    wp_bp_groups_members: Data: 0.00MB + Index: 0.00MB
    wp_bp_links: Data: 0.00MB + Index: 0.00MB
    wp_bp_links_categories: Data: 0.00MB + Index: 0.00MB
    wp_bp_links_linkmeta: Data: 0.00MB + Index: 0.00MB
    wp_bp_links_votes: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_drafts: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_labels: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_label_message: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_messages: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_meta: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_notices: Data: 0.00MB + Index: 0.00MB
    wp_bp_messages_recipients: Data: 0.00MB + Index: 0.00MB
    wp_bp_notifications: Data: 0.00MB + Index: 0.00MB
    wp_bp_notifications_meta: Data: 0.00MB + Index: 0.00MB
    wp_bp_user_blogs: Data: 0.00MB + Index: 0.00MB
    wp_bp_user_blogs_blogmeta: Data: 0.00MB + Index: 0.01MB
    wp_bp_xprofile_data: Data: 0.00MB + Index: 0.00MB
    wp_bp_xprofile_fields: Data: 0.03MB + Index: 0.05MB
    wp_bp_xprofile_groups: Data: 0.00MB + Index: 0.00MB
    wp_bp_xprofile_meta: Data: 0.01MB + Index: 0.02MB
    wp_buddyboss_media: Data: 0.00MB + Index: 0.00MB
    wp_buddyboss_media_albums: Data: 0.00MB + Index: 0.00MB
    wp_commentmeta: Data: 0.00MB + Index: 0.01MB
    wp_comments: Data: 0.01MB + Index: 0.01MB
    wp_gde_profiles: Data: 0.00MB + Index: 0.00MB
    wp_gde_secure: Data: 0.00MB + Index: 0.00MB
    wp_learndash_user_activity: Data: 0.01MB + Index: 0.03MB
    wp_learndash_user_activity_meta: Data: 0.04MB + Index: 0.03MB
    wp_links: Data: 0.00MB + Index: 0.00MB
    wp_options: Data: 2.97MB + Index: 0.09MB
    wp_pmpro_discount_codes: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_discount_codes_levels: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_discount_codes_uses: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_memberships_categories: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_memberships_pages: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_memberships_users: Data: 0.00MB + Index: 0.01MB
    wp_pmpro_membership_levelmeta: Data: 0.00MB + Index: 0.00MB
    wp_pmpro_membership_levels: Data: 0.00MB + Index: 0.01MB
    wp_pmpro_membership_orders: Data: 0.00MB + Index: 0.02MB
    wp_pmxi_files: Data: 0.00MB + Index: 0.00MB
    wp_pmxi_history: Data: 0.00MB + Index: 0.00MB
    wp_pmxi_imports: Data: 0.00MB + Index: 0.00MB
    wp_pmxi_posts: Data: 0.00MB + Index: 0.00MB
    wp_pmxi_templates: Data: 0.00MB + Index: 0.00MB
    wp_postmeta: Data: 0.83MB + Index: 0.21MB
    wp_posts: Data: 2.47MB + Index: 0.17MB
    wp_pp_login_builder: Data: 0.01MB + Index: 0.00MB
    wp_pp_password_reset_builder: Data: 0.01MB + Index: 0.00MB
    wp_pp_registration_builder: Data: 0.01MB + Index: 0.00MB
    wp_revslider_css: Data: 0.09MB + Index: 0.00MB
    wp_revslider_layer_animations: Data: 0.00MB + Index: 0.00MB
    wp_revslider_navigations: Data: 0.00MB + Index: 0.00MB
    wp_revslider_sliders: Data: 0.02MB + Index: 0.00MB
    wp_revslider_slides: Data: 0.18MB + Index: 0.00MB
    wp_revslider_static_slides: Data: 0.00MB + Index: 0.00MB
    wp_signups: Data: 0.00MB + Index: 0.00MB
    wp_social_users: Data: 0.00MB + Index: 0.00MB
    wp_termmeta: Data: 0.00MB + Index: 0.01MB
    wp_terms: Data: 0.00MB + Index: 0.01MB
    wp_term_relationships: Data: 0.00MB + Index: 0.01MB
    wp_term_taxonomy: Data: 0.00MB + Index: 0.01MB
    wp_usermeta: Data: 0.05MB + Index: 0.04MB
    wp_users: Data: 0.00MB + Index: 0.01MB
    wp_waiting: Data: 0.00MB + Index: 0.00MB
    wp_wc_download_log: Data: 0.00MB + Index: 0.00MB
    wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB
    wp_wfBadLeechers: Data: 0.00MB + Index: 0.00MB
    wp_wfBlockedCommentLog: Data: 0.00MB + Index: 0.00MB
    wp_wfBlockedIPLog: Data: 0.00MB + Index: 0.00MB
    wp_wfBlocks7: Data: 0.00MB + Index: 0.00MB
    wp_wfConfig: Data: 0.36MB + Index: 0.01MB
    wp_wfCrawlers: Data: 0.00MB + Index: 0.00MB
    wp_wfFileChanges: Data: 0.00MB + Index: 0.00MB
    wp_wfFileMods: Data: 0.48MB + Index: 0.11MB
    wp_wfHits: Data: 0.14MB + Index: 0.03MB
    wp_wfHoover: Data: 0.00MB + Index: 0.00MB
    wp_wfIssues: Data: 0.00MB + Index: 0.00MB
    wp_wfKnownFileList: Data: 0.97MB + Index: 0.12MB
    wp_wfLeechers: Data: 0.00MB + Index: 0.01MB
    wp_wfLiveTrafficHuman: Data: 0.00MB + Index: 0.00MB
    wp_wfLocs: Data: 0.00MB + Index: 0.00MB
    wp_wfLogins: Data: 0.01MB + Index: 0.00MB
    wp_wfNet404s: Data: 0.00MB + Index: 0.00MB
    wp_wfNotifications: Data: 0.00MB + Index: 0.00MB
    wp_wfPendingIssues: Data: 0.00MB + Index: 0.00MB
    wp_wfReverseCache: Data: 0.00MB + Index: 0.00MB
    wp_wfScanners: Data: 0.00MB + Index: 0.00MB
    wp_wfSNIPCache: Data: 0.00MB + Index: 0.00MB
    wp_wfStatus: Data: 0.06MB + Index: 0.03MB
    wp_wfVulnScanners: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_category: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_form: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_lock: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_master: Data: 0.02MB + Index: 0.00MB
    wp_wp_pro_quiz_prerequisite: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_question: Data: 1.24MB + Index: 0.03MB
    wp_wp_pro_quiz_statistic: Data: 0.01MB + Index: 0.00MB
    wp_wp_pro_quiz_statistic_ref: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_template: Data: 0.00MB + Index: 0.00MB
    wp_wp_pro_quiz_toplist: Data: 0.00MB + Index: 0.00MB
    wp_wsluserscontacts: Data: 0.00MB + Index: 0.00MB
    wp_wslusersprofiles: Data: 0.00MB + Index: 0.00MB
    
    ### Post Type Counts ###
    
    attachment: 121
    bmt-member-type: 4
    bp-email: 32
    cdfc: 1
    condition_group: 1
    custom_css: 1
    customize_changeset: 9
    forum: 1
    jetpack_migration: 2
    mc4wp-form: 1
    nav_menu_item: 33
    page: 39
    post: 24
    product: 12
    revision: 1003
    scheduled-action: 16
    sfwd-certificates: 1
    sfwd-courses: 7
    sfwd-lessons: 36
    sfwd-quiz: 38
    sfwd-topic: 147
    shop_order: 7
    shop_subscription: 5
    sidebar: 1
    sp_wps_shortcodes: 1
    topic: 4
    wc_membership_plan: 6
    wcps: 1
    woocarousel: 1
    wpachievements: 3
    wpcf7_contact_form: 1
    wpe_product_carousel: 1
    yith_wcps_type: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ❌
    					Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
    Hide errors from visitors: ✔
    
    ### Active Plugins (50) ###
    
    Addons for WPBakery Page Builder: by Livemesh – 1.9.1
    Akismet Anti-Spam: by Automattic – 4.0.7
    bbPress: by The bbPress Community – 2.5.14
    Better Search Replace: by Delicious Brains – 1.3.2
    Boss for LearnDash: by BuddyBoss – 1.3.0
    BP Redirect To Profile: by Brajesh Singh – 1.2.2
    BuddyBoss Inbox: by BuddyBoss – 1.1.3
    BuddyBoss Media: by BuddyBoss – 3.2.4
    BuddyBoss One Click Installer: by BuddyBoss – 1.0.6
    BuddyBoss Wall: by BuddyBoss – 1.3.3
    BuddyPress for LearnDash: by BuddyBoss – 1.2.4
    BuddyPress Member Types: by BuddyBoss – 1.1.2
    BuddyPress: by The BuddyPress Community – 3.0.0
    Contact Form 7: by Takayuki Miyoshi – 5.0.2
    Force HTTPS: by LittleBizzy – 1.0.6
    Google Doc Embedder: by Kevin Davis
    Dan Lester – 2.6.4
    
    Insert or Embed Articulate Content into WordPress Trial: by Brian Batt – 4.292
    WPBakery Page Builder: by Michael M - WPBakery.com – 5.4.7
    LearnDash Content Cloner: by WisdmLabs – 1.2.2
    LearnDash & bbPress Integration: by LearnDash – 2.0.2.1
    LearnDash Course Grid: by LearnDash – 1.4.1
    LearnDash ProPanel: by LearnDash – 2.1.3
    LearnDash WooCommerce Integration: by LearnDash – 1.4.0 – Not tested with the active version of WooCommerce
    Mega Addons For Visual Composer: by Nasir – 2.2
    Nextend Social Login: by Nextendweb – 3.0.10
    Nextend Social Login Pro Addon: by Nextendweb – 3.0.8
    WooCommerce Product Carousel Slider: by ADL Plugins – 3.0.2 – Not tested with the active version of WooCommerce
    Restrict Content: by Pippin Williamson – 2.2.3
    Slider Revolution: by ThemePunch – 5.4.7.3
    LearnDash LMS: by LearnDash – 2.5.8.2
    Simple Buddypress Profile Privacy: by Justin Hansen – 0.7.7
    String Locator: by Clorith – 2.3.0
    Theme My Login: by Jeff Farthing – 6.4.16
    Uncanny LearnDash Toolkit: by Uncanny Owl – 2.4.2
    Uncanny LearnDash Toolkit Pro: by Uncanny Owl – 2.3.1
    UpdraftPlus - Backup/Restore: by UpdraftPlus.Com
    DavidAnderson – 1.14.11
    
    Essential WPBakery Page Builder (formerly Visual Composer) Addons: by themebon – 1.9.1
    Waiting: by Plugin Builders – 0.4.5
    WC4BP -> WooCommerce BuddyPress Integration (Premium): by ThemeKraft – 3.1.4 – Not tested with the active version of WooCommerce
    WC4BP -> Subscriptions: by ThemeKraft – 1.1.0 – Not tested with the active version of WooCommerce
    WC4BP -> BuddyPress xProfile Checkout Manager: by ThemeKraft – 1.3.0 – Not tested with the active version of WooCommerce
    WooCommerce Colors: by WooThemes – 1.0.7 – Not tested with the active version of WooCommerce
    WooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.5
    WooCommerce Stripe Gateway: by WooCommerce – 4.1.6
    WooCommerce Memberships: by SkyVerge – 1.10.4
    WooCommerce Social Login: by SkyVerge – 2.5.2
    WooCommerce Subscriptions: by Prospress Inc. – 2.2.21
    WooCommerce: by Automattic – 3.4.1 – 3.4.2 is available
    WP File Manager: by mndpsingh287 – 2.7
    WP Rollback: by WordImpress – 1.5
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: ✔
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: course (course)
    external (external)
    grouped (grouped)
    simple (simple)
    subscription (subscription)
    variable (variable)
    variable subscription (variable-subscription)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    ### WC Pages ###
    
    Shop base: ❌ Page not set
    Cart: #562 - /cart/
    Checkout: #9648 - /woocommerce-checkout/
    My account: #9671 - /membership/
    Terms and conditions: ❌ Page not set
    
    ### Theme ###
    
    Name: Boss. Child Theme
    Version: 2.4.3
    Author URL: http://www.buddyboss.com
    Child Theme: ✔
    Parent Theme Name: Boss.
    Parent Theme Version: 2.4.6
    Parent Theme Author URL: https://www.buddyboss.com
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: –
    
    ### subscriptions ###
    
    WCS_DEBUG: ✔
    						No
    Subscriptions Mode: ✔
    						Live
    Subscriptions Template Theme Overrides: –
    Report Cache Enabled: ✔
    						Yes
    Cache Update Failures: ✔
    						0 failure
    
    #267708
    Lena Stergatou
    Participant

    Hi. I made a minor change in the code @danbp suggests (basically the $args[‘subnav_slug’] and now I believe it works as expected.
    So I guess it’s not a BuddyPress bug.

    Please, try the following

    
    function bpex_change_profile_settings_default_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :
    
    	$access        = bp_core_can_edit_settings();
    	$slug          = bp_get_settings_slug();
    
    	$args = array(
    		'parent_slug'     => $slug,
    		'subnav_slug'	  => 'notifications',
    		'screen_function' => 'bp_settings_screen_notification',
    		'user_has_access' => $access
    		);
     
    	bp_core_new_nav_default( $args );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_change_profile_settings_default_tab' );
    
    function bpex_remove_general_item_on_usermenu() {
    global $wp_admin_bar;
    
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-settings-general' );
    	}
    
    }
    add_action( 'wp_before_admin_bar_render', 'bpex_remove_general_item_on_usermenu' );
    
    function bpex_remove_profile_settings_general_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :	
    
    		bp_core_remove_subnav_item( 'settings', 'general' );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_remove_profile_settings_general_tab' );
    #262774

    In reply to: Custom Member Tab

    Starting point is https://codex.buddypress.org/developer/function-examples/core/bp_core_new_nav_item/

    But adding a full function looks like:

    
    /**
     * adds the profile user nav link
     */
    add_action( 'bp_setup_nav', 'add_calendar_2_bp_nav_item' );
    function add_calendar_2_bp_nav_item() {
    	global $bp;
    
    	$args = array(
    		'name' => __( 'Calendar', 'buddypress' ),
    		'slug' => 'my-calendar',
    		'default_subnav_slug' => 'my-calendar',
    		'position' => 80,
    		'screen_function' => 'bp_nav_tab_stuff',
    		'item_css_id' => 'my-calendar',
    	);
    
    	bp_core_new_nav_item( $args );
    }
    

    But to do anything with the above, you’ll need to add stuff to display:

    
    /**
     * Creates the screen function content
     */
    function bp_nav_tab_stuff() {
    	add_action( 'bp_template_title',  'bp_nav_tab_screen_title' );
    	add_action( 'bp_template_content',  'bp_nav_tab_screen_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin',  'members/single/plugins' ) );
    }
    
    function bp_nav_tab_screen_title() {
    	echo '<h3>My Calendar Title</h3>';
    }
    
    function bp_nav_tab_screen_content() {
    	echo '<p>You can choose to embed an iframe from Google Calendar and then the source will be the ID of the calendar you want to embed. You can find this under Settings > Calendar Address > Calendar ID.</p>';
    	echo '<p><iframe src="https://calendar.google.com/calendar/embed?src=barthmaier.com_sd2o58ua3efj7ne1m8o3p8n91g@group.calendar.google.com&ctz=America/New_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe></p>';
    	echo '<p>Of course, the above is just one way to add a calendar.</p>';
    }
    
    #261682
    sweeneytodd94
    Participant

    (Latest version of WP/BP; non-bundled custom theme, using child theme.)

    When adding a custom index & members-loop to /members/ in my child-theme, to make some adjustments to the members directory layout, individual profile pages break completely, I think defaulting to the pages.php but loaded without any content.

    childtheme/members/members-loop.php

    <?php 
    //global $members_template;
    //$reset_members_template = $members_template;
    
    do_action( 'bp_before_members_loop' ); ?>
    
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&per_page=21&type=alphabetical' ) ) : ?>
    
    	<div id="pag-top" class="pagination">
    		<div class="pag-count" id="member-dir-count-top"><?php bp_members_pagination_count(); ?></div>
    		<div class="pagination-links" id="member-dir-pag-top"><?php bp_members_pagination_links(); ?></div>
    	</div>
    
    	<?php do_action( 'bp_before_directory_members_list' ); ?>
    
    	<ul id="members-list" class="item-list" role="main">
    
    	<?php while ( bp_members() ) : bp_the_member(); ?>
    
    		<li>
    			<div class="item-avatar">
    				<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar('type=full&width=80&height=80'); ?></a>
    			</div>
    			<div class="item">
    				<div class="item-title"><a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a></div>
    				<div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
    				<?php do_action( 'bp_directory_members_item' ); ?>
    			</div>
    			<div class="action">
    				<?php do_action( 'bp_directory_members_actions' ); ?>
    			</div>
    			<div class="clear"></div>
    		</li>
    
    	<?php endwhile; ?>
    
    	</ul>
    
    	<?php do_action( 'bp_after_directory_members_list' ); ?>
    
    	<?php bp_member_hidden_fields(); ?>
    
    	<div id="pag-bottom" class="pagination">
    		<div class="pag-count" id="member-dir-count-bottom"><?php bp_members_pagination_count(); ?></div>
    		<div class="pagination-links" id="member-dir-pag-bottom"><?php bp_members_pagination_links(); ?></div>
    	</div>
    
    <?php else: ?>
    	<div id="message" class="info"><p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p></div>
    <?php endif; 
    
    //$members_template = $reset_members_template;
    ?>
    
    <?php do_action( 'bp_after_members_loop' ); ?>

    childtheme/members/index.php

    <?php
    
    /**
     * BuddyPress - Members Directory
     *
     * @package BuddyPress
     * @subpackage bp-default - SSSMG
     */
    
    get_header( 'buddypress' ); ?>
    
    	<?php do_action( 'bp_before_directory_members_page' ); ?>
    
    <div class="container">
    <div class="row">
    <div id="primary" class="col-md-10">
    
    	<div id="content" role="main" class="<?php do_action( 'content_class' ); ?>">
    		<div class="padder">
    		<div class="buddypress">
    
    		<?php do_action( 'bp_before_directory_members' ); ?>
    		
    	<form action="" method="post" id="members-directory-form" class="dir-form">
    	
    	<?php do_action( 'bp_before_directory_members_content' ); ?>
    
    	<div id="members-dir-search" class="dir-search" role="search">
    		<?php bp_directory_members_search_form(); ?>
    	</div><!-- #members-dir-search -->
    
    	<?php do_action( 'bp_before_directory_members_tabs' ); ?>
    
    		<div class="item-list-tabs" role="navigation">
    			<ul>
    				<li class="selected" id="members-all"><a href="<?php bp_members_directory_permalink(); ?>"><?php printf( __( 'All Members %s', 'buddypress' ), '<span>' . bp_core_get_total_member_count() . '</span>' ); ?></a></li>
    
    				<?php if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
    					<li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'; ?>"><?php printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); ?></a></li>
    				<?php endif; ?>
    
    				<?php do_action( 'bp_members_directory_member_types' ); ?>
    
    			</ul>
    		</div><!-- .item-list-tabs -->
    
    		<div id="members-dir-list" class="members dir-list">
    			<?php //bp_get_template_part( 'members/members-loop' );
    				locate_template( array( 'members/members-loop.php' ), true );
    			?>
    		</div><!-- #members-dir-list -->
    
    		<?php do_action( 'bp_directory_members_content' ); ?>
    
    		<?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ); ?>
    
    		<?php do_action( 'bp_after_directory_members_content' ); ?>
    
    	</form><!-- #members-directory-form -->
    
    	<?php do_action( 'bp_after_directory_members' ); ?>
    
    </div><!-- #buddypress -->
    </div><!-- .padder -->
    	</div><!-- #content -->
    
    </div><!-- primary -->
    <?php get_sidebar( 'buddypress' ); ?>
    </div><!-- row -->
    </div><!-- container -->
    
    	<?php do_action( 'bp_after_directory_members_page' ); ?>
    
    <?php get_footer( 'buddypress' ); ?>

    bp-custom.php

    <?php
    // bp-custom.php - BP hacks and mods will go here
    /**
     * Include bbPress 'topic' custom post type in WordPress' search results */
     
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'forum' custom post type in WordPress' search results */
    
    function ntwb_bbp_forum_cpt_search( $forum_search ) {
    	$forum_search['exclude_from_search'] = false;
    	return $forum_search;
    }
    add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results  */
    
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );
    
    /**
     * Ensure that multiselect boxes have trailing brackets in their 'id' and 'name' attributes.
     *
     * These brackets are required for an array of values to be sent in the POST
     * request. Previously, bp_get_the_profile_field_input_name() contained the
     * necessary logic, but since BP 2.0 that logic has been moved into
     * BP_XProfile_Field_Type_Multiselectbox. Since bp-default does not use the
     * BP_XProfile_Field_Type classes to build its markup, it did not inherit
     * the brackets from their new location. Thus this workaround.
     */
    function bp_dtheme_add_brackets_to_multiselectbox_attributes( $name ) {
    	global $field;
    
    	if ( 'multiselectbox' === $field->type ) {
    		$name .= '[]';
    	}
    
    	return $name;
    }
    add_filter( 'bp_get_the_profile_field_input_name', 'bp_dtheme_add_brackets_to_multiselectbox_attributes' );
    
    // add the custom column headers to BP manage signups
    function philopress_modify_user_columns($column_headers) {
            $column_headers['extended'] = 'Extended';
            return $column_headers;
    }
    add_action('manage_users_page_bp-signups_columns','philopress_modify_user_columns');
    
    // dump all the pending user's meta data in the custom column
    function philopress_signup_custom_column( $str, $column_name, $signup_object ) {
    	if ( $column_name == 'extended' ) 
                 return print_r( $signup_object->meta, true );
            return $str;
    }
    add_filter( 'bp_members_signup_custom_column', 'philopress_signup_custom_column', 1, 3 );
    
    //* Redirect WordPress Logout to Home Page
    add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));
    
    //add @mentions to bbpress forum
    function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
    	if ( function_exists( 'bbpress' ) && is_bbpress() ) {
    		$retval = true;
    	}
    	return $retval;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
    
    function bphelp_dpioml(){
    	$bphelp_my_profile_field_1='Profession';
    	$bphelp_my_profile_field_2='Primary Institution';
           if( is_user_logged_in() && bp_is_members_component() ) { ?>
            <div class="bph_xprofile_fields">
                              <?php if(bphelp_my_profile_field_1<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_1 );  ?><br />
    						  <?php if(bphelp_my_profile_field_2<>"") echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_2 );  ?><br />
                    </div><?php
           }
    }
    add_action('bp_directory_members_item', 'bphelp_dpioml');
    
    ?>

    I’ve tried all sorts of different combinations but whatever I do, the only way to get both the profile pages and the members directory to display is to remove the index and members-loop customizations. Then everything works fine, but without the adjustments to the members directory that I want (removing recent updates, for instance). Any pointers would be brilliant!

    Bingo Bongo
    Participant

    Hey Guys,

    I think I’m getting somewhere now 😉

    One thing that’s stumping me, is Adding Friends.

    I don’t see it on the friendships page, eg zetaunit.com/members/bishop/friends/

    And I don’t see Add Friends on the BuddyPress dropdown menu in the Admin bar at the top of the page either (Activity, Profile, Notifications…etc down to Settings)

    I don’t see a link to ‘Members’ either on the BuddyPress dropdown menu, which would kind of help.

    Or even a link/tab on the User’s Profile page would be useful.

    Anything really to make it easier to Add Friends

    So, was wondering again if I’d missed something, or if it was just a case of going to the Members page.

    (I know I can add my own menu & I’ve done that under the main navigation menu for the site under Forums > Members, but it doesn’t have the nice Notification bubbles that the top Admin menu has)

    Any pointers would be great, thanks!

    #260968
    danbp
    Participant

    @masoud1111,

    You’re talking about 2 different things: profile and groups. Let me explain you a little…

    On the buddy nav bar, navigation looks similar but doesn’t work the same way on profile and on group page. While profile navigation use nav and sub-nav, the group navigation use only sub-nav.

    Also, as documented on codex, define('BP_DEFAULT_COMPONENT', '...' ); is a constant related to a component, not a sub-nav tab. It let you define the default landing component, but not the one or other sub-nav tab. For example on profiles, the component Activity has 4 sub-nav attached to it: personnal, mentions, favorites, friends, groups

    To get one of them, you need to specify a new default tab, not another component. 🙂

    Buddybar main nav items on profile page
    Activity Profile Friends Groups Forums (if you use group forums)

    Default tab is Activity/personnal. To change it for “Friends” you use the constant:
    define('BP_DEFAULT_COMPONENT', 'friends' );

    To change the default landing tab from (Component/sub-tab). For example Activity/personnal to Activity/mentions, you define a new nav default tab with a function like this one:

    function bpex_set_member_default_nav() {
     
        bp_core_new_nav_default (
            array(
                'parent_slug'       => buddypress()->activity->id,
    	   // other "activity" sub_nav slugs : personal favorites friends groups
                'subnav_slug'       => 'mentions',
                'screen_function'   => 'bp_activity_screen_mentions'
            )
        );
    }
    add_action( 'bp_setup_nav', 'bpex_set_member_default_nav', 20 );

    For groups, it’s a similar technique, but a different syntax. The following example is a bit sophisticated, as it let you change the landing tab differently for each defined group.
    Depending each group activity or target, you can choose a different default tab.
    In this example, the kill bill group has Forum as landing tab, while Leon’s group use the group member directory.

    function bpex_custom_group_default_tab( $default_tab ){
    	/**
    	 * class_exists() is recommanded to avoid problems during updates 
    	 * or when Groups Component is deactivated
    	 */
    	if ( class_exists( 'BP_Group_Extension' ) ) : 
    	
    	$group = groups_get_current_group();//get the current group
    	
    	if( empty( $group ) ) {
    	 return $default_tab;
    	}
    		switch($group->slug){
    			
    			case 'kill-bill': // group name (use slug format)
    			$default_tab='forum';
    			break;
    			
    			case 'leon':
    			$default_tab='members';
    			break;
    			
    			default:		
    			$default_tab='home';// the default landing tab
    			break;
    			
    		}
    	
    	return $default_tab;
    	
    	endif; // end if ( class_exists( 'BP_Group_Extension' ) )
    }
    add_filter('bp_groups_default_extension','bpex_custom_group_default_tab');

    All this tested and working with BP 2.7.2 / Twenty Sixteen

    wolfpup64
    Participant

    I posted up on this a little while ago, and danbp was a boss and helped me out, and I thought I could get it to work, but the end fix ended up unfortunately not really fixing the problem.

    I’m having difficulty with a profile tab that is supposed to link to a separate forums profile (wpForo) via a dynamic link that recognizes the displayed user’s page. danbp set me up with something like the below, I changed a bit to make it work better…

    function tab_custom_link_to_page() {
    
    	if ( bp_is_page( 'BP_MEMBERS' ) ||  bp_is_activity_component() || bp_is_profile_component () || bp_is_groups_component () || bp_is_notifications_component () || bp_is_messages_component () || bp_is_settings_component () || bp_is_following_component () || bp_is_followers_component () ) {
    		
    		$link = bp_get_root_domain() . '/community/profile/'. bp_get_displayed_user_username();
    		echo '<li><a href="'. $link .'">Community</a></li>'; 
    	}  
    }
    add_action( 'bp_member_options_nav', 'tab_custom_link_to_page', 10 );

    but I couldnt change the location of the tab, using code or BuddyBoss Reorder Tabs plugin, which is an issue because the theme I’m using (BuddyBoss Boss.) hides the tabs at the end under a clickable “…”. I spoke to someone at BuddyBoss and they told me I wouldn’t be able to move the tab unless it was registered as a “bp_core_new_nav_item( array(“, which requires an array like:

    function add_communityprofile_tab() {
    	global $bp;	
    	bp_core_new_nav_item( array(
    		'name'                  => 'Community',
    		'slug'                  => 'community',
    		'parent_url'            => $bp->displayed_user->domain,
    		'parent_slug'           => $bp->profile->slug,		
    		'position'              => 200,
    		'default_subnav_slug'   => 'community'
    	) );
    }
    add_action( 'bp_setup_nav', 'add_communityprofile_tab', 100 );

    which works fine until I have to link it, apparently I can’t use the tab array/slug thing to reach a dynamic link without the same “$bp->displayed_user->domain”. The link I’m trying to reach is currently at:

    http://localhost/wordpress/community/profile/*displayeduser*/

    from:

    http://localhost/wordpress/users/*displayeduser*/

    If nobody has any helpful suggestions otherwise, I’m thinking the best route might be to have the page

    http://localhost/wordpress/users/*displayeduser*/community/

    redirect to

    http://localhost/wordpress/community/profile/*displayeduser*/

    via a dynamic redirect…I’m trying to figure out how to do that.

    If anyone has any helpful advice it would be super appreciated. My boss wants me to take the site live this week and I think I’m just about there…aside from this huge disconnect between the two separate user profiles…not too bad for someone who has barely any idea what they’re doing. but yeah, sorry for the super long post. thanks for reading and hopefully you can throw me a line.

    – Andrew

    #259530
    danbp
    Participant

    Hi @sherissa_r,

    General is the default landing tab for profile settings.
    To remove it, you use these functions:
    to remove the item -> bp_core_remove_subnav_item()
    to define a new one -> bp_core_new_nav_default()

    You may also want to remove General from usermenu if you use WP’s toolbar, in which case you need -> $wp_admin_bar->remove_node()

    Note that General is also the default sub-nav template for all other Settings (Emails & Profile visibility). When you remove the item, you remove also the template. That’s why you need to define a new landing tab.
    Note also that once General is removed, you will only see the other settings buttons, but no the content of the new defined tab. It will only appear once you clicked on the button.

    Here the snippets you could test (add them to bp-custom)

    function bpex_change_profile_settings_default_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :
    
    	$access        = bp_core_can_edit_settings();
    	$slug          = bp_get_settings_slug();
    
    	$args = array(
    		'parent_slug'     => $slug,
    		'subnav_slug'	  => $slug . '/notifications/',
    		'screen_function' => 'bp_settings_screen_notification',
    		'user_has_access' => $access
    		);
     
    	bp_core_new_nav_default( $args );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_change_profile_settings_default_tab' );
    
    function bpex_remove_general_item_on_usermenu() {
    global $wp_admin_bar;
    
    	if ( bp_use_wp_admin_bar() ) {
    		$wp_admin_bar->remove_node( 'my-account-settings-general' );
    	}
    
    }
    add_action( 'wp_before_admin_bar_render', 'bpex_remove_general_item_on_usermenu' );
    
    function bpex_remove_profile_settings_general_tab() {
    
    	if( bp_is_active( 'xprofile' ) ) :	
    
    		bp_core_remove_subnav_item( 'settings', 'general' );
    
    	endif;
    
    }
    add_action( 'bp_actions', 'bpex_remove_profile_settings_general_tab' );
    danbp
    Participant

    Hi @rezbiz,

    in brief, you want to add some status dependent custom link to the BuddyBar.

    I’ll ignore Kleo (premium theme) and Visual Composer (third party plugin).

    Following examples let you add an external link to a non BP page on almost any menus (except BP usermenu).

    How it works ?
    – create a test page and call it Book.
    – the page slug must be /book/
    – the link (tab/button) will be displayed to logged-in users only.

    I made also a snippet which add such a link to the WordPress Main Menu. This menu is the one you see in WP’s menu customizer by default. Depending the theme you use, you have always a main menu and X others. This can vary and it’s to you to find how it can/should work eventually. See theme documentation and WP Codex if you get in trouble with it.
    Note that it should work with all Twenty themes at least.

    Add the snippets to bp-custom.php and see the result. After that, read through the code and modify the page name/ID and slug to your need. Leave anything else untouched.

    
    // add Custom tab on site wide activity and members directory pages
    function tab_custom_link_to_page() {
    
    	if ( bp_is_activity_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    
    		if ( !is_user_logged_in() )
    			return false;
    
    		// link to what you want
    		$link = bp_get_root_domain() . '/book';
    
    		echo'<li><a href="'. $link .'">My Book</a></li>'; 
    	}
      
    }
    add_action( 'bp_activity_type_tabs', 'tab_custom_link_to_page' ); // site wide activity page
    add_action( 'bp_members_directory_member_types', 'tab_custom_link_to_page' ); // members directory page
    
    // add Custom tab on Profile Nav
    function add_profiles_link_to_page(){
    
    	if ( bp_is_profile_component() || bp_is_user() ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/book/';
    
    	?>
    		<li><a href="<?php echo $link; ?>"><?php printf( 'My Book' ); ?></a></li>
    	<?php  
    	}
    }
    add_action( 'bp_member_options_nav', 'add_profiles_link_to_page' );
    
    // add Custom tab on Groups Nav
    function add_groups_link_to_page(){
    
    if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
    
    	$link = bp_get_root_domain() . '/';
    
    	bp_core_new_subnav_item( array(
    		'name'			=> 'My Book',
    		'slug'			=> 'book',
    		'parent_slug'		=> bp_get_current_group_slug(),
    		'parent_url'		=> $link,
    		'screen_function'	=> true, 
    		'position'		=> 40 ) );
    	}
    }
    add_action( 'bp_setup_nav', 'add_groups_link_to_page' );
    
    // add Custom tab on Groups Directory
    function add_groups_directory_link_to_page() {
    
    	if( bp_is_active( 'groups' ) ) {
    
    	if ( !is_user_logged_in() )
    		return false;
     
        if ( bp_is_current_action( 'custom' ) ) 
            return;
     
    	$link = bp_get_root_domain() . '/book';
    
        $button_args = array(
            'id'         => 'my-books',
            'component'  => 'groups',
            'link_text'  => 'My Book',
            'link_title' => 'My Book',
            'link_class' => 'my-books no-ajax',
            'link_href'  => $link,
            'wrapper'    => false,
            'block_self' => false,
        );  
       
        ?>
    		<li><?php echo bp_get_button( apply_filters( 'bp_get_group_custom_button', $button_args ) ); ?></a></li>
        <?php
    	}	
    }
    add_action( 'bp_groups_directory_group_filter', 'add_groups_directory_link_to_page' );
    
    // add Custom tab on WP Main Menu ( after Home, About, etc )
    function main_menu_custom_link_to_page( $menu ) { 
         
    	if ( !is_user_logged_in() )
    			return $menu;
    	else
     	// link to what you want
    	$link = bp_get_root_domain() . '/book';
    
    	$grouplink = '<li><a href="'. $link . '">My Book</a></li>';
    
    	$menu = $menu . $grouplink;
    	return $menu;
    }
    add_filter( 'wp_nav_menu_items', 'main_menu_custom_link_to_page' );

    Yes, it looks complicated, but it isn’t. Simply it’s not homogeneous ! 🙂

    danbp
    Participant

    @fearthemoose, @rezbiz,

    Here “the best guarded secret” finally revealed !
    But it’s not a secret, is part of Codex and a multi handled topic subject on this forum.

    What we want to do: remove access possibility.
    Where: on BuddyBar navigation menu (the one below the profile header).
    Specifics: make the activity and forum tabs only visible to the logged in user.

    NOTE: The activity tab is shown by default when you visit a profile.

    As we are going to hide/remove this tab to visitors, we need to define as first another default tab. If we won’t do that, the visitor will get a Page not found error. Which is not exactly the case here, the page exist but the visitor can’t access it.

    Let’s define arbitrary Profile as the new default tab. You can of course define what ever other existing tab on your BuddyBar as default.

    Add this line to bp-custom.php
    define( 'BP_DEFAULT_COMPONENT','profile' );

    Now the mega “open secret” !

    The folowing snippet contains almost any BP menu items you can have on a BuddyBar, and includes also the Forum item, in case you use bbPress.
    You can remove or comment out those you don’t want to use.
    Note also that it is only an example – you have to play with it to fit your need. But at least you have the right syntax to use.
    Note also that some profile menu items are user only, such as message or notice. In other words, these are always private.

    This function goes preferably to bp-custom.php

    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' ) ) :
            
            /** here we fix the conditions. 
            * Are we on a profile page ? | is user site admin ? | is user logged in ?
            */
    	if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) {
    
            /* and here we remove our stuff ! */
    		bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'friends' );
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    	}
    	endif;
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    Some other hints for privacy
    if you want to allow only the profile owner to view some tabs, replace
    !is_user_logged_in by !bp_is_my_profile() – this scenario doesn’t need a check for logged in users as it is made by bp_is_my_profile.

    If you want only to make a profile private, read here.

    If you want to remove a sub-nav item (ie. View on Profile), you use something like:
    bp_core_remove_subnav_item( 'profile', 'view' );

    Many other possibilities for navigation are also available, including for groups. Several examples are given on Codex, here.

    And if not enough, RTFM and search the forum ! 🙂

    Have fun !

    #258209
    danbp
    Participant

    Hi,

    bp’s Usermenu is added to wp_admin_menu on the Toolbar, under Howdy. This BP menu ID is “my-account”.

    When you’re on a profile page, you see also these items in the Buddymenu, below the profile header cover.

    Some working examples here:
    Remove an item from Usermenu

    Remove an item from Buddymenu

    Since 2.6, BuddyPress use a navigation API. See here for many use case.

    Read also WP codex about admin bar menus.

    Where to put BuddyPress custom code ?
    Usually into bp-custom.php. This file is to BP code what a child theme is to a theme: a safe place with high priority where nothing get to loose when an update occurs !

    Child’s functions.php should be reserved to whatever you need for the theme itself.
    That said, it can happen(rarely) that some custom code won’t work from within bp-custom. In this case, feel free to remove it from bp-custom and give it a try inside child’s functions.php.

    As novice, you’re invited to read BP and WP codex if you want to customize.

    #258094

    In reply to: New Privacy Plugin

    danbp
    Participant

    hi @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 in buddypress/bp-core/classes/class-bp-core-nav.php on line 279from

    sbpp04_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:798

    Another 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.

    #256750
    danbp
    Participant

    Documentation for this is in bp-core-buddybar.php

    Some working examples for navigation (since 2.6) here.

    And here a working example for:

    1. remove Delete Account on user profile settings tab
    2. add a new sub-nav item for “Memberships” to Profile > Settings

    1 )

    function bpex_remove_profile_settings_sub_tab() {   
    	// remove Delete Account from Profile Settings
    	bp_core_remove_subnav_item( BP_SETTINGS_SLUG, 'delete-account' );
    }
    add_action( 'bp_actions', 'bpex_remove_profile_settings_sub_tab' );

    2 )

    function bpex_add_sub_nav_to_profile_settings() {
    global $bp;
    $parent_slug = 'settings';
    $child_slug = 'memberships';
    		
    		//Add subnav item 	 
    		bp_core_new_subnav_item( array( 
    			'name'			=> __( 'My Memberships', 'textdomain' ),
    			'slug'			=> $child_slug, 
    			'parent_url'		=> $bp->loggedin_user->domain . $parent_slug.'/', 
    			'parent_slug'		=> $parent_slug, 
    			'screen_function'	=> 'bpex_profile_membership_screen'
    		) );
    }
    
    		function bpex_profile_membership_screen() {	
    			add_action( 'bp_template_content', 'bpex_profile_membership_screen_content' );
    			bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    		}
    
    		function bpex_profile_membership_screen_content() {
    			do_action( 'my_membership_post' );
    		}
    add_action( 'bp_setup_nav', 'bpex_add_sub_nav_to_profile_settings', 100 );
    
    function bpex_membership_stuff() {
    echo 'Some stuff here ?'; ?>
    <h2>Lorem Ipsum for ever !</h2>
    <p>Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.</p>
    <?php
    }
    add_action( 'my_membership_post', 'bpex_membership_stuff' );

    Add this to bp-custom.php

Viewing 25 results - 1 through 25 (of 53 total)
Skip to toolbar