/** * Register site- or network-admin nav menu elements. * * Contextually hooked to site or network-admin depending on current configuration. * * @since 1.6.0 * * @uses add_management_page() To add the Recount page in Tools section. * @uses add_options_page() To add the Forums settings page in Settings * section. */ public function admin_menus() { // Bail if user cannot moderate. if (!bp_current_user_can('manage_options')) { return; } // About. add_dashboard_page(__('Welcome to BuddyPress', 'buddypress'), __('Welcome to BuddyPress', 'buddypress'), 'manage_options', 'bp-about', array($this, 'about_screen')); // Credits. add_dashboard_page(__('Welcome to BuddyPress', 'buddypress'), __('Welcome to BuddyPress', 'buddypress'), 'manage_options', 'bp-credits', array($this, 'credits_screen')); $hooks = array(); // Changed in BP 1.6 . See bp_core_admin_backpat_menu(). $hooks[] = add_menu_page(__('BuddyPress', 'buddypress'), __('BuddyPress', 'buddypress'), $this->capability, 'bp-general-settings', 'bp_core_admin_backpat_menu', 'div'); $hooks[] = add_submenu_page('bp-general-settings', __('BuddyPress Help', 'buddypress'), __('Help', 'buddypress'), $this->capability, 'bp-general-settings', 'bp_core_admin_backpat_page'); // Add the option pages. $hooks[] = add_submenu_page($this->settings_page, __('BuddyPress Components', 'buddypress'), __('BuddyPress', 'buddypress'), $this->capability, 'bp-components', 'bp_core_admin_components_settings'); $hooks[] = add_submenu_page($this->settings_page, __('BuddyPress Pages', 'buddypress'), __('BuddyPress Pages', 'buddypress'), $this->capability, 'bp-page-settings', 'bp_core_admin_slugs_settings'); $hooks[] = add_submenu_page($this->settings_page, __('BuddyPress Options', 'buddypress'), __('BuddyPress Options', 'buddypress'), $this->capability, 'bp-settings', 'bp_core_admin_settings'); // 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'; $hooks[] = add_menu_page(__('Tools', 'buddypress'), __('Tools', 'buddypress'), $this->capability, $tools_parent, 'bp_core_tools_top_level_item', '', 24); $hooks[] = add_submenu_page($tools_parent, __('Available Tools', 'buddypress'), __('Available Tools', 'buddypress'), $this->capability, 'available-tools', 'bp_core_admin_available_tools_page'); } else { $tools_parent = 'tools.php'; } $hooks[] = add_submenu_page($tools_parent, __('BuddyPress Tools', 'buddypress'), __('BuddyPress', 'buddypress'), $this->capability, 'bp-tools', 'bp_core_admin_tools'); // For network-wide configs, add a link to (the root site's) Emails screen. if (is_network_admin() && bp_is_network_activated()) { $email_labels = bp_get_email_post_type_labels(); $email_url = get_admin_url(bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type()); $hooks[] = add_menu_page($email_labels['name'], $email_labels['menu_name'], $this->capability, '', '', 'dashicons-email', 26); // Hack: change the link to point to the root site's admin, not the network admin. $GLOBALS['menu'][26][2] = esc_url_raw($email_url); } foreach ($hooks as $hook) { add_action("admin_head-{$hook}", 'bp_core_modify_admin_menu_highlight'); } }
/** * Set up post types. * * @since BuddyPress (2.4.0) */ public function register_post_types() { // Emails if (bp_is_root_blog() && !is_network_admin()) { register_post_type(bp_get_email_post_type(), apply_filters('bp_register_email_post_type', array('description' => _x('BuddyPress emails', 'email post type description', 'buddypress'), 'labels' => bp_get_email_post_type_labels(), 'menu_icon' => 'dashicons-email', 'public' => false, 'publicly_queryable' => bp_current_user_can('bp_moderate'), 'query_var' => false, 'rewrite' => false, 'show_in_admin_bar' => false, 'show_ui' => bp_current_user_can('bp_moderate'), 'supports' => bp_get_email_post_type_supports()))); } parent::register_post_types(); }