bp_members_invitations_setup_nav()

Set up the displayed user’s Members Invitations nav.


Source Source

File: bp-members/bp-members-invitations.php

function bp_members_invitations_setup_nav() {
	if ( ! bp_get_members_invitations_allowed() ) {
		return;
	}

	$user_has_access     = bp_user_has_access();
	$default_subnav_slug = ( bp_is_my_profile() && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_send_screen' ) ) ? 'send-invites' : 'list-invites';

	/* Add 'Invitations' to the main user profile navigation */
	bp_core_new_nav_item(
		array(
			'name'                    => __( 'Invitations', 'buddypress' ),
			'slug'                    => bp_get_members_invitations_slug(),
			'position'                => 80,
			'screen_function'         => 'members_screen_send_invites',
			'default_subnav_slug'     => $default_subnav_slug,
			'show_for_displayed_user' => $user_has_access && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_screens' )
		)
	);

	$parent_link = trailingslashit( bp_displayed_user_domain() . bp_get_members_invitations_slug() );

	/* Create two subnav items for community invitations */
	bp_core_new_subnav_item(
		array(
			'name'            => __( 'Send Invites', 'buddypress' ),
			'slug'            => 'send-invites',
			'parent_slug'     => bp_get_members_invitations_slug(),
			'parent_url'      => $parent_link,
			'screen_function' => 'members_screen_send_invites',
			'position'        => 10,
			'user_has_access' => $user_has_access && bp_is_my_profile() && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_send_screen' )
		)
	);

	bp_core_new_subnav_item(
		array(
			'name'            => __( 'Pending Invites', 'buddypress' ),
			'slug'            => 'list-invites',
			'parent_slug'     => bp_get_members_invitations_slug(),
			'parent_url'      => $parent_link,
			'screen_function' => 'members_screen_list_sent_invites',
			'position'        => 20,
			'user_has_access' => $user_has_access && bp_user_can( bp_displayed_user_id(), 'bp_members_invitations_view_screens' )
		)
	);
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.