BP_Members_Admin::admin_menus()
Create the All Users / Profile > Edit Profile and All Users Signups submenus.
Description
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', 'buddyboss' ),
__( 'Edit Profile', 'buddyboss' ),
'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(
__( 'Pending Signups', 'buddyboss' ),
__( 'Pending Signups', 'buddyboss' ),
$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' ) );
}
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.