BBP_Admin::admin_menus()
Add the admin menus
Description Description
Source Source
File: includes/admin/classes/class-bbp-admin.php
public function admin_menus() { // Default hooks array $hooks = array(); // Get the tools pages $tools = bbp_get_tools_admin_pages(); // Loop through tools and check if ( ! empty( $tools ) ) { foreach ( $tools as $tool ) { // Try to add the admin page $page = add_management_page( $tool['name'], $tool['name'], $tool['cap'], $tool['page'], $tool['func'] ); // Add page to hook if user can view it if ( false !== $page ) { $hooks[] = $page; } } // Fudge the highlighted subnav item when on a bbPress admin page if ( ! empty( $hooks ) ) { foreach ( $hooks as $hook ) { add_action( "admin_head-{$hook}", 'bbp_tools_modify_menu_highlight' ); } } } // Forums Tools Root add_management_page( esc_html__( 'Forums', 'bbpress' ), bbp_maybe_append_pending_upgrade_count( esc_html__( 'Forums', 'bbpress' ) ), 'bbp_tools_page', 'bbp-repair', 'bbp_admin_repair_page' ); // Are settings enabled? if ( 'basic' === bbp_settings_integration() ) { add_options_page( esc_html__( 'Forums', 'bbpress' ), esc_html__( 'Forums', 'bbpress' ), 'bbp_settings_page', 'bbpress', 'bbp_admin_settings' ); } // These are later removed in admin_head if ( current_user_can( 'bbp_about_page' ) ) { // About add_dashboard_page( esc_html__( 'Welcome to bbPress', 'bbpress' ), esc_html__( 'Welcome to bbPress', 'bbpress' ), 'bbp_about_page', 'bbp-about', array( $this, 'about_screen' ) ); // Credits add_dashboard_page( esc_html__( 'Welcome to bbPress', 'bbpress' ), esc_html__( 'Welcome to bbPress', 'bbpress' ), 'bbp_about_page', 'bbp-credits', array( $this, 'credits_screen' ) ); } // Bail if plugin is not network activated if ( ! is_plugin_active_for_network( bbpress()->basename ) ) { return; } add_submenu_page( 'index.php', esc_html__( 'Update Forums', 'bbpress' ), esc_html__( 'Update Forums', 'bbpress' ), 'manage_network', 'bbp-update', array( $this, 'update_screen' ) ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |