bp_members_admin_bar_add_invitations_menu()

Add the “Invitations” menu and submenus.


Source Source

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

function bp_members_admin_bar_add_invitations_menu() {
	global $wp_admin_bar;

	// Bail if this is an ajax request.
	if ( wp_doing_ajax() ) {
		return;
	}

	if ( bp_current_user_can( 'bp_members_invitations_view_screens' ) ) {
		$bp               = buddypress();
		$invitations_link = trailingslashit( bp_loggedin_user_domain() . bp_get_members_invitations_slug() );

		$wp_admin_bar->add_node(
			array(
				'id'     => $bp->my_account_menu_id . '-invitations',
				'parent' => $bp->my_account_menu_id,
				'title'  => __( 'Invitations', 'buddypress' ),
				'href'   => $invitations_link,
				'meta'   => array(
					'class'  => 'ab-sub-secondary'
				)
			)
		);

		if ( bp_current_user_can( 'bp_members_invitations_view_send_screen' ) ) {
			$wp_admin_bar->add_node(
				array(
					'id'     => $bp->my_account_menu_id . '-invitations-send',
					'parent' => $bp->my_account_menu_id . '-invitations',
					'title'  => __( 'Send Invites', 'buddypress' ),
					'href'   => $invitations_link . 'send-invites/',
					'meta'   => array(
						'class'  => 'ab-sub-secondary'
					)
				)
			);
		}

		$wp_admin_bar->add_node(
			array(
				'id'     => $bp->my_account_menu_id . '-invitations-list',
				'parent' => $bp->my_account_menu_id . '-invitations',
				'title'  => __( 'Pending Invites', 'buddypress' ),
				'href'   => $invitations_link . 'list-invites/',
				'meta'   => array(
					'class'  => 'ab-sub-secondary'
				)
			)
		);
	}
}


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.