bp_core_admin_get_directory_pages()
Generate a list of directory pages, for use when building Components panel markup.
Description
Return
(array)
Source
File: bp-core/admin/bp-core-admin-slugs.php
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | function bp_core_admin_get_directory_pages() { $bp = buddypress(); $directory_pages = array (); // Loop through loaded components and collect directories. if ( is_array ( $bp ->loaded_components ) ) { foreach ( $bp ->loaded_components as $component_slug => $component_id ) { // Only components that need directories should be listed here. if ( isset( $bp ->{ $component_id } ) && ! empty ( $bp ->{ $component_id }->has_directory ) ) { // The component->name property was introduced in BP 1.5, so we must provide a fallback. $directory_pages [ $component_id ] = ! empty ( $bp ->{ $component_id }->name ) ? $bp ->{ $component_id }->name : ucwords( $component_id ); } } } if ( function_exists( 'bp_nouveau_get_appearance_settings' ) ) { if ( bp_nouveau_get_appearance_settings( 'user_front_page' ) ) { $directory_pages [ 'profile_dashboard' ] = __( 'Profile Dashboard' , 'buddyboss' ); } } // Add new Forums option into the Pages. if ( bp_is_active( 'forums' ) ) { if ( bp_is_active( 'groups' ) ) { $directory_pages = array_insert_after( $directory_pages , 'groups' , array ( 'new_forums_page' => __( 'Forums' , 'buddyboss' ) ) ); } else { $directory_pages = array_insert_after( $directory_pages , 'members' , array ( 'new_forums_page' => __( 'Forums' , 'buddyboss' ) ) ); } } /** Directory Display *****************************************************/ /** * Filters the loaded components needing directory page association to a WordPress page. * * @since BuddyPress 1.5.0 * * @param array $directory_pages Array of available components to set associations for. */ return apply_filters( 'bp_directory_pages' , $directory_pages ); } |
Changelog
Version | Description |
---|---|
BuddyPress 2.4.1 | 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.