Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'add profile tab to nav bar'

Viewing 25 results - 1 through 25 (of 44 total)
  • Author
    Search Results
  • #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' );
    #267708
    lenasterg
    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>';
    }
    
    #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

    #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

    danbp
    Participant

    Merci @imath !

    The old way

    The following syntax to change the tab order is deprecated since 2.6 and will throw an error notice:

    function rt_change_profile_tab_order() {
    global $bp;
    $bp->bp_nav['profile']['position'] = 10;
    $bp->bp_nav['activity']['position'] = 20;
    }
    add_action( 'bp_setup_nav', 'rt_change_profile_tab_order', 999 );

    The new way

    Now the correct syntax to use for modifying – since 2.6 – the tabs position on the buddybar when you’re on a profile.

    This example list all BP related items who appear by default on a profile nav, in order of appearance and include also the forum tab (if you use bbPress for group forums).
    By default, activity tab comes as 1st. The snippet will move it to 4th position.

    To modify a position you simply change the numeric value.
    If you want to move only one item, you remove or comment (add // at begin of the line) the ones you don’t want to move.

    function bpex_primary_nav_tabs_position() {
    	buddypress()->members->nav->edit_nav( array( 'position' => 4,	), 'activity' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 5, 	), 'profile' 		); 
    	buddypress()->members->nav->edit_nav( array( 'position' => 7, 	), 'notifications'	); 
    	buddypress()->members->nav->edit_nav( array( 'position' => 9,	), 'messages' 	  	);
    	buddypress()->members->nav->edit_nav( array( 'position' => 2,	), 'friends' 	  	);
    	buddypress()->members->nav->edit_nav( array( 'position' => 6,	), 'groups' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 3, 	), 'forums' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 1, 	), 'settings' 		);
    }
    add_action( 'bp_setup_nav', 'bpex_primary_nav_tabs_position', 999 );

    That’s it for the buddybar nav menu order on profile.

    danbp
    Participant

    Give 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');
    #253437
    danbp
    Participant

    Hi @famous,

    anything directly related to URL for bp is listed here:
    http://hookr.io/plugins/buddypress/#index=l&search=url

    In most case, you can built a link by array, which generally extend pre existing parameters. It’s very variable and depend where and how the link shoud work.

    Here some exemple snippets to add a link to a member’s profile.

    /* add external link on buddy menu bar */
    function bpfr_menubar_link() {
    global $bp;
    
    if ( !is_user_logged_in() )
        return false;
    
    $link = bp_get_loggedin_user_link();
    
    	$bp->bp_nav[$slug] = array(
    			'name'                    => 'View my profile',
    			'slug'                    => 'super_link',
    			'link'                    => $link,
    			'css_id'                  => 'super-link',	
    			'position'                => 20
    		);
    }
    add_action( 'bp_core_new_nav_item', 'bpfr_menubar_link', 999 );
    
    /* link to profile on SWA page */
    function goto_my_profile_tab() {
      if ( !is_user_logged_in() )
        return false;
    
      if ( bp_is_active( 'xprofile' ) )
    
        echo '<li><a href="'. bp_get_loggedin_user_link() .'">View my profile</a></li>';
      
    }
    add_action( 'bp_activity_type_tabs', 'goto_my_profile_tab' ); // SWA page
    add_action( 'bp_members_directory_member_types', 'goto_my_profile_tab' ); // members directory page
    
    /* shortcode linking to profile [xyz] */
    function bpfr_link_to_profile() {	
    return '<a href="'. bp_get_loggedin_user_link() .'">View my profile</a>';			
    }
    add_shortcode( 'xyz', 'bpfr_link_to_profile' );

    Another technique for groups here.

    In hope this will help you to go further.

    #243147
    danbp
    Participant

    @seore, please search a bit before asking ! For example “add profile tab to nav bar”
    https://buddypress.org/support/search/add+profile+tab+to+nav+bar/

    BP use slgihtly same technique as WordPress to build menus.
    https://codex.wordpress.org/Function_Reference/wp_nav_menu

    #241429
    danbp
    Participant
    function bpfr_remove_change_avatar_tab() {
    global $bp;
    	bp_core_remove_subnav_item( 'profile', 'change-avatar' );
    
    }
    add_action( 'bp_ready', 'bpfr_remove_change_avatar_tab', 15 );

    BuddyBar items

    Source: bp-core-buddybar.php
    function bp_core_remove_subnav_item( $parent_id, $slug )
    and to remove a nav item
    function bp_core_remove_nav_item( $parent_id )

    #232729
    modemlooper
    Moderator

    This is for the admin bar:

    function custom_adminbar_titles() {
        global $wp_admin_bar;
    
            $wp_admin_bar->add_menu( array(
                    'id'    => 'my-account-groups-memberships',
                    'title' => 'new title here',
                )
    
            );
    }
    add_action( 'wp_before_admin_bar_render', 'custom_adminbar_titles' );

    This is for profile menu:

    function change_profile_submenu_tabs(){
    	global $bp;
    
    	$bp->bp_options_nav['groups']['my-groups']['name'] = 'new name here';
    }
    add_action('bp_setup_nav', 'change_profile_submenu_tabs', 999);
    #190937
    danbp
    Participant

    @durkk,

    IMHO you do it overcomplicated.

    Create a new page; call it “extra”
    Create eventually a template for it. Basically, you made a copy of your theme “page.php”, you rename it “my-extra_page.php” and in the file header, you remove the original page comment and replace it with the new template comment.

    /*
    * Template name: my extra page
    */

    Save !

    Back to the page “extra” > edit and asign it the new template.

    Now you can add a this page to each profile by using the abose snippet from the child-theme functions.php

    
    function bpfr_my_setup_nav() {
        global $bp;
    	
    	$mytab=array(
    	'name'            => 'My Tab',
    	'link'      	  => 'permalink_to_your_page', // the one under the page title on page editor
    	'slug'         	  => 'my-tab',
    	'css_id'          => 'my_custom_tab',
    	'position'        => 100,
    	'user_has_access' => 1,
        'screen_function' => 'xprofile_screen_my_tab'
    	);
    	$bp->bp_options_nav['profile']['my-tab'] = $mytab; 	
    }
    add_action('bp_setup_nav', 'bpfr_my_setup_nav');

    You can now add into this page template any code you want. To call a plugin, a specific content or what else.

    To avoid this page to be shown in the menu bar, you can use this old plugin (it still works with 4.0)

    To use a shortcode from within the text widget (this is not possible by default)
    you can add this to your child-theme functions.php add_filter('widget_text', 'do_shortcode', 11);
    Now you can use a shortcode in this widget !

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