BP_Members_Admin::admin_menus()

Create the All Users / Profile > Edit Profile and All Users Signups submenus.


Source Source

File: bp-members/classes/class-bp-members-admin.php

	public function admin_menus() {

		// Setup the hooks array.
		$hooks = array();

		// Manage user's profile.
		$hooks['user'] = $this->user_page = add_submenu_page(
			$this->user_profile . '.php',
			__( 'Edit Profile',  'buddypress' ),
			__( 'Edit Profile',  'buddypress' ),
			'read',
			'bp-profile-edit',
			array( $this, 'user_admin' )
		);

		// Only show sign-ups where they belong.
		if ( ( ! bp_is_network_activated() && ! is_network_admin() ) || ( is_network_admin() && bp_is_network_activated() ) ) {

			// Manage signups.
			$hooks['signups'] = $this->signups_page = add_users_page(
				__( 'Manage Signups',  'buddypress' ),
				__( 'Manage Signups',  'buddypress' ),
				$this->capability,
				'bp-signups',
				array( $this, 'signups_admin' )
			);
		}

		// For consistency with non-Multisite, we add a Tools menu in
		// the Network Admin as a home for our Tools panel.
		if ( is_multisite() && bp_core_do_network_admin() ) {
			$tools_parent = 'network-tools';
		} else {
			$tools_parent = 'tools.php';
		}

		$hooks['members_invitations'] = $this->members_invites_page = add_submenu_page(
			$tools_parent,
			__( 'Manage Invitations',  'buddypress' ),
			__( 'Manage Invitations',  'buddypress' ),
			$this->capability,
			'bp-members-invitations',
			array( $this, 'invitations_admin' )
		);

		$edit_page         = 'user-edit';
		$profile_page      = 'profile';
		$this->users_page  = 'users';

		// Self profile check is needed for this pages.
		$page_head = array(
			$edit_page        . '.php',
			$profile_page     . '.php',
			$this->user_page,
			$this->users_page . '.php',
		);

		// Append '-network' to each array item if in network admin.
		if ( is_network_admin() ) {
			$edit_page          .= '-network';
			$profile_page       .= '-network';
			$this->user_page    .= '-network';
			$this->users_page   .= '-network';
			$this->signups_page .= '-network';

			$this->members_invites_page .= '-network';
		}

		// Setup the screen ID's.
		$this->screen_id = array(
			$edit_page,
			$this->user_page,
			$profile_page
		);

		// Loop through new hooks and add method actions.
		foreach ( $hooks as $key => $hook ) {
			add_action( "load-{$hook}", array( $this, $key . '_admin_load' ) );
		}

		// Add the profile_admin_head method to proper admin_head actions.
		foreach ( $page_head as $head ) {
			add_action( "admin_head-{$head}", array( $this, 'profile_admin_head' ) );
		}

		// Highlight the BuddyPress tools submenu when managing invitations.
		add_action( "admin_head-{$this->members_invites_page}", 'bp_core_modify_admin_menu_highlight' );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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