BP_Members_Admin::admin_menus()

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


Description Description


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' )
			);
		}

		$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';
		}

		// 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' ) );
		}
	}

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.