Changeset 13514
- Timestamp:
- 07/12/2023 03:38:26 AM (14 months ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13502 r13514 260 260 261 261 // Only components with 'has_directory' require a WP page to function. 262 foreach ( array_keys( $bp->loaded_components ) as$component_id ) {262 foreach ( $bp->loaded_components as $component_slug => $component_id ) { 263 263 if ( ! empty( $bp->{$component_id}->has_directory ) ) { 264 264 $wp_page_components[] = array( … … 291 291 foreach ( $wp_page_components as $component ) { 292 292 if ( ! isset( $bp->pages->{$component['id']} ) ) { 293 $orphaned_components[ $component['id'] ] = $component['name']; 293 $component_props = $component; 294 if ( isset( $bp->{$component['id']}->directory_title ) ) { 295 $component_props['title'] = $bp->{$component['id']}->directory_title; 296 } else { 297 $component_props['title'] = $component_props['name']; 298 } 299 300 if ( isset( $bp->{$component['id']}->root_slug ) ) { 301 $component_props['name'] = $bp->{$component['id']}->root_slug; 302 } 303 304 $orphaned_components[ $component['id'] ] = $component_props; 294 305 } 295 306 } … … 300 311 // Translators: %s is the comma separated list of components needing a directory page. 301 312 __( 'The following active BuddyPress Components do not have associated BuddyPress Pages: %s.', 'buddypress' ), 302 '<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', $orphaned_components) ) . '</strong>'313 '<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', wp_list_pluck( $orphaned_components, 'title' ) ) ) . '</strong>' 303 314 ); 304 315 … … 310 321 $notice = sprintf( 311 322 // Translators: %s is the comma separated list of components needing a directory page. 312 __( 'A BuddyPress page has been added for the following active BuddyPress Components which did not have associated BuddyPress Pages yet: %s. ', 'buddypress' ),313 '<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', $orphaned_components) ) . '</strong>'323 __( 'A BuddyPress page has been added for the following active BuddyPress Components which did not have associated BuddyPress Pages yet: %s. You may need to refresh your permalink settings.', 'buddypress' ), 324 '<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', wp_list_pluck( $orphaned_components, 'title' ) ) ) . '</strong>' 314 325 ); 315 326 } -
trunk/src/bp-core/bp-core-functions.php
r13503 r13514 851 851 $page_titles = bp_core_get_directory_page_default_titles(); 852 852 if ( $return_pages ) { 853 $components_title = wp_list_pluck( $components, 'title' ); 854 if ( ! $components_title ) { 855 $components_title = $components; 856 } 857 853 858 // In this case the `$components` array uses Page titles as values. 854 $page_titles = bp_parse_args( $page_titles, $components );859 $page_titles = bp_parse_args( $page_titles, $components_title ); 855 860 } 856 861 … … 883 888 884 889 // Create the pages. 885 foreach ( $pages_to_create as $component_name => $page_ name ) {890 foreach ( $pages_to_create as $component_name => $page_title ) { 886 891 $existing_id = bp_core_get_directory_page_id( $component_name ); 887 892 … … 890 895 $pages[ $component_name ] = (int) $existing_id; 891 896 } else { 892 $p ages[ $component_name ] = wp_insert_post(array(897 $postarr = array( 893 898 'comment_status' => 'closed', 894 899 'ping_status' => 'closed', 895 900 'post_status' => 'publish', 896 'post_title' => $page_ name,901 'post_title' => $page_title, 897 902 'post_type' => bp_core_get_directory_post_type(), 898 ) ); 903 ); 904 905 if ( isset( $components[ $component_name ]['name'] ) ) { 906 $postarr['post_name'] = $components[ $component_name ]['name']; 907 } 908 909 $pages[ $component_name ] = wp_insert_post( $postarr ); 899 910 } 900 911 }
Note: See TracChangeset
for help on using the changeset viewer.