Changeset 13471
- Timestamp:
- 05/07/2023 11:36:50 AM (17 months ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-embeds.php
r12757 r13471 348 348 do_action( 'bp_activity_embed_after_media' ); 349 349 } 350 351 /** 352 * Make sure the Activity embed template will be used if neded. 353 * 354 * @since 12.0.0 355 * 356 * @param WP_Query $query Required. 357 */ 358 function bp_activity_parse_embed_query( $query ) { 359 if ( bp_is_single_activity() && $query->get( 'embed' ) ) { 360 $query->is_embed = true; 361 } 362 } 363 add_action( 'bp_members_parse_query', 'bp_activity_parse_embed_query', 10, 1 ); -
trunk/src/bp-activity/classes/class-bp-activity-component.php
r13464 r13471 578 578 parent::blocks_init( $blocks ); 579 579 } 580 581 /**582 * Add the Activity directory state.583 *584 * @since 10.0.0585 *586 * @param array $states Optional. See BP_Component::admin_directory_states() for description.587 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.588 * @return array See BP_Component::admin_directory_states() for description.589 */590 public function admin_directory_states( $states = array(), $post = null ) {591 $bp = buddypress();592 593 if ( isset( $bp->pages->activity->id ) && (int) $bp->pages->activity->id === (int) $post->ID ) {594 $states['page_for_activity_directory'] = _x( 'BP Activity Page', 'page label', 'buddypress' );595 }596 597 return parent::admin_directory_states( $states, $post );598 }599 580 } -
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13464 r13471 528 528 parent::blocks_init( $blocks ); 529 529 } 530 531 /**532 * Add the Sites directory states.533 *534 * @since 10.0.0535 *536 * @param array $states Optional. See BP_Component::admin_directory_states() for description.537 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.538 * @return array See BP_Component::admin_directory_states() for description.539 */540 public function admin_directory_states( $states = array(), $post = null ) {541 $bp = buddypress();542 543 if ( isset( $bp->pages->blogs->id ) && (int) $bp->pages->blogs->id === (int) $post->ID ) {544 $states['page_for_sites_directory'] = _x( 'BP Sites Page', 'page label', 'buddypress' );545 }546 547 return parent::admin_directory_states( $states, $post );548 }549 530 } -
trunk/src/bp-core/admin/bp-core-admin-actions.php
r13461 r13471 61 61 add_action( 'bp_admin_menu', 'bp_admin_separator' ); 62 62 63 // Add a filter to include BP Components directory pages display states.64 add_filter( 'display_post_states', 'bp_admin_display_directory_states', 10, 2 );65 66 63 /** 67 64 * When a new site is created in a multisite installation, run the activation … … 239 236 do_action( 'bp_register_admin_settings' ); 240 237 } 241 242 /**243 * Dedicated filter to inform about BP components directory page states.244 *245 * @since 10.0.0246 *247 * @param string[] $post_states An array of post display states.248 * @param WP_Post $post The current post object.249 */250 function bp_admin_display_directory_states( $post_states = array(), $post = null ) {251 /**252 * Filter here to add BP Directory pages.253 *254 * Used internaly by BP_Component->admin_directory_states(). Please use the dynamic255 * filter in BP_Component->admin_directory_states() to edit the directory state256 * according to the component's ID.257 *258 * @since 10.0.0259 *260 * @param array $value An empty array.261 * @param WP_Post $post The current post object.262 */263 $directory_page_states = apply_filters( 'bp_admin_display_directory_states', array(), $post );264 265 if ( $directory_page_states ) {266 $post_states = array_merge( $post_states, $directory_page_states );267 }268 269 return $post_states;270 } -
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13469 r13471 670 670 break; 671 671 672 // Pages page.673 case 'settings_page_bp-page-settings':674 // Help tabs.675 $screen->add_help_tab(676 array(677 'id' => 'bp-page-overview',678 'title' => __( 'Overview', 'buddypress' ),679 'content' => bp_core_add_contextual_help_content( 'bp-page-overview' ),680 )681 );682 683 // Help panel - sidebar links.684 $screen->set_help_sidebar(685 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .686 '<p>' . __( '<a href="https://codex.buddypress.org/getting-started/configure-components/#settings-buddypress-pages">Managing Pages</a>', 'buddypress' ) . '</p>' .687 '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'688 );689 690 break;691 692 672 // Settings page. 693 673 case 'settings_page_bp-settings': … … 732 712 } 733 713 add_action( 'load-settings_page_bp-components', 'bp_core_add_contextual_help' ); 734 add_action( 'load-settings_page_bp-page-settings', 'bp_core_add_contextual_help' );735 714 add_action( 'load-settings_page_bp-settings', 'bp_core_add_contextual_help' ); 736 715 add_action( 'load-users_page_bp-profile-setup', 'bp_core_add_contextual_help' ); … … 749 728 case 'bp-comp-overview': 750 729 $retval = __( 'By default, all but four of the BuddyPress components are enabled. You can selectively enable or disable any of the components by using the form below. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ); 751 break;752 753 case 'bp-page-overview':754 $retval = __( 'BuddyPress Components use WordPress Pages for their root directory/archive pages. You can change the page associations for each active component by using the form below.', 'buddypress' );755 730 break; 756 731 … … 1493 1468 * 1494 1469 * @since 8.0.0 1470 * @since 12.0.0 This category is left for third party plugin but not used anymmore. 1471 * 1472 * @todo deprecate. 1495 1473 */ 1496 1474 function bp_block_init_category_filter() { -
trunk/src/bp-core/bp-core-catchuri.php
r13468 r13471 130 130 $wp_query->is_singular = true; 131 131 $wp_query->is_404 = false; 132 133 // Check if a BuddyPress component's direcory is set as homepage. 134 $wp_query->is_home = bp_is_directory_homepage( bp_current_component() ); 132 135 133 136 /** … … 172 175 $wp_query->is_singular = true; 173 176 $wp_query->is_404 = false; 177 178 // Check if a BuddyPress component's direcory is set as homepage. 179 $wp_query->is_home = bp_is_directory_homepage( bp_current_component() ); 174 180 } 175 181 -
trunk/src/bp-core/bp-core-filters.php
r13436 r13471 948 948 949 949 /** 950 * Eventually append BuddyPress directories to WP Dropdown's pages control. 951 * 952 * @since 12.0.0 953 * 954 * @param WP_Post[] $pages Array of page objects. 955 * @param array $args Array of get_pages() arguments. 956 * @return WP_Post[] Array of page objects, potentially including BP directories. 957 */ 958 function bp_core_include_directory_on_front( $pages = array(), $args = array() ) { 959 $is_page_on_front_dropdown = false; 960 961 if ( isset( $args['name'] ) ) { 962 $is_page_on_front_dropdown = 'page_on_front' === $args['name']; 963 964 if ( is_customize_preview() ) { 965 $is_page_on_front_dropdown = '_customize-dropdown-pages-page_on_front' === $args['name']; 966 } 967 } 968 969 if ( $is_page_on_front_dropdown ) { 970 $directories = bp_core_get_directory_pages(); 971 $null = '0000-00-00 00:00:00'; 972 973 foreach ( (array) $directories as $component => $directory ) { 974 if ( 'activate' === $component || 'register' === $component ) { 975 continue; 976 } 977 978 $post = (object) array( 979 'ID' => $directory->id, 980 'post_author' => 0, 981 'post_date' => $null, 982 'post_date_gmt' => $null, 983 'post_content' => '', 984 'post_title' => $directory->title, 985 'post_excerpt' => '', 986 'post_status' => 'publish', 987 'comment_status' => 'closed', 988 'ping_status' => 'closed', 989 'post_password' => '', 990 'post_name' => $directory->slug, 991 'pinged' => '', 992 'to_ping' => '', 993 'post_modified' => $null, 994 'post_modified_gmt' => $null, 995 'post_content_filtered' => '', 996 'post_parent' => 0, 997 'guid' => bp_rewrites_get_url( 998 array( 999 'component_id' => $component, 1000 ) 1001 ), 1002 'menu_order' => 0, 1003 'post_type' => 'buddypress', 1004 'post_mime_type' => '', 1005 'comment_count' => 0, 1006 'filter' => 'raw', 1007 ); 1008 1009 $pages[] = get_post( $post ); 1010 } 1011 1012 $pages = bp_alpha_sort_by_key( $pages, 'post_title' ); 1013 } 1014 1015 return $pages; 1016 } 1017 add_filter( 'get_pages', 'bp_core_include_directory_on_front', 10, 2 ); 1018 1019 /** 950 1020 * Filter SQL query strings to swap out the 'meta_id' column. 951 1021 * … … 1336 1406 } 1337 1407 add_filter( 'subdirectory_reserved_names', 'bp_core_components_subdirectory_reserved_names' ); 1408 1409 /** 1410 * Make sure `buddypress` post type links are built using BP Rewrites. 1411 * 1412 * @since 12.0.0 1413 * 1414 * @param string $link The post type link. 1415 * @param WP_Post|null $post The post type object. 1416 * @return string The post type link. 1417 */ 1418 function bp_get_post_type_link( $link = '', $post = null ) { 1419 if ( 'rewrites' === bp_core_get_query_parser() && 'buddypress' === get_post_type( $post ) ) { 1420 $bp_pages = (array) buddypress()->pages; 1421 1422 $bp_current_page = wp_list_filter( $bp_pages, array( 'id' => $post->ID ) ); 1423 if ( $bp_current_page ) { 1424 $args = array( 1425 'component_id' => key( $bp_current_page ), 1426 ); 1427 1428 if ( 'register' === $args['component_id'] || 'activate' === $args['component_id'] ) { 1429 $key_action = 'member_' . $args['component_id']; 1430 $args['component_id'] = 'members'; 1431 $args[ $key_action ] = 1; 1432 } 1433 1434 $link = bp_rewrites_get_url( $args ); 1435 } 1436 } 1437 1438 return $link; 1439 } 1440 add_filter( 'post_type_link', 'bp_get_post_type_link', 10, 2 ); -
trunk/src/bp-core/classes/class-bp-component.php
r13468 r13471 600 600 } 601 601 602 // Set directory page states.603 add_filter( 'bp_admin_display_directory_states', array( $this, 'admin_directory_states' ), 10, 2 );604 605 602 /** 606 603 * Fires at the end of the setup_actions method inside BP_Component. … … 1278 1275 $query->is_front_page = false; 1279 1276 $query->is_page = false; 1280 $query->is_single = true;1281 1277 $query->is_archive = false; 1282 1278 $query->is_tax = false; 1279 1280 if ( ! is_embed() ) { 1281 $query->is_single = true; 1282 } 1283 1283 } 1284 1284 … … 1390 1390 * 1391 1391 * @since 10.0.0 1392 * @deprecated 12.0.0 1392 1393 * 1393 1394 * @param string[] $states An array of post display states. … … 1396 1397 */ 1397 1398 public function admin_directory_states( $states = array(), $post = null ) { 1398 if ( $this->has_directory ) { 1399 /** 1400 * Filter here to edit the component's directory states. 1401 * 1402 * This is a dynamic hook that is based on the component string ID. 1403 * 1404 * @since 10.0.0 1405 * 1406 * @param string[] $states An array of post display states. 1407 * @param WP_Post $post The current post object. 1408 */ 1409 return apply_filters( 'bp_' . $this->id . '_admin_directory_states', $states, $post ); 1410 } 1411 1399 _deprecated_function( __METHOD__, '12.0.0' ); 1412 1400 return $states; 1413 1401 } -
trunk/src/bp-core/classes/class-bp-core.php
r13464 r13471 348 348 ), 349 349 'description' => __( 'The BuddyPress Post Type used for component directories.', 'buddypress' ), 350 'public' => false,350 'public' => true, 351 351 'hierarchical' => true, 352 352 'exclude_from_search' => true, … … 354 354 'show_ui' => false, 355 355 'show_in_nav_menus' => true, 356 'show_in_rest' => false,356 'show_in_rest' => true, 357 357 'supports' => array( 'title' ), 358 358 'has_archive' => false, -
trunk/src/bp-core/deprecated/12.0.php
r13468 r13471 626 626 do_action_deprecated( 'bp_blogs_blog_tabs', array(), '12.0.0' ); 627 627 } 628 629 /** 630 * Dedicated filter to inform about BP components directory page states. 631 * 632 * @since 10.0.0 633 * @deprecated 12.0.0 634 * 635 * @param string[] $post_states An array of post display states. 636 * @param WP_Post $post The current post object. 637 */ 638 function bp_admin_display_directory_states( $post_states = array(), $post = null ) { 639 $states = array(); 640 641 /** 642 * Filter here to add BP Directory pages. 643 * 644 * Used internaly by BP_Component->admin_directory_states(). Please use the dynamic 645 * filter in BP_Component->admin_directory_states() to edit the directory state 646 * according to the component's ID. 647 * 648 * @since 10.0.0 649 * @deprecated 12.0.0 650 * 651 * @param array $states An empty array. 652 * @param WP_Post $post The current post object. 653 */ 654 $directory_page_states = apply_filters_deprecated( 'bp_admin_display_directory_states', array( $states, $post ), '12.0.0' ); 655 656 if ( $directory_page_states ) { 657 $post_states = array_merge( $post_states, $directory_page_states ); 658 } 659 660 return $post_states; 661 } -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13468 r13471 1260 1260 ); 1261 1261 } 1262 1263 /**1264 * Add the Groups directory states.1265 *1266 * @since 10.0.01267 *1268 * @param array $states Optional. See BP_Component::admin_directory_states() for description.1269 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.1270 * @return array See BP_Component::admin_directory_states() for description.1271 */1272 public function admin_directory_states( $states = array(), $post = null ) {1273 $bp = buddypress();1274 1275 if ( isset( $bp->pages->groups->id ) && (int) $bp->pages->groups->id === (int) $post->ID ) {1276 $states['page_for_groups_directory'] = _x( 'BP Groups Page', 'page label', 'buddypress' );1277 }1278 1279 return parent::admin_directory_states( $states, $post );1280 }1281 1262 } -
trunk/src/bp-members/classes/class-bp-members-component.php
r13468 r13471 1030 1030 ); 1031 1031 } 1032 1033 /**1034 * Add the Members directory states.1035 *1036 * @since 10.0.01037 *1038 * @param array $states Optional. See BP_Component::admin_directory_states() for description.1039 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.1040 * @return array See BP_Component::admin_directory_states() for description.1041 */1042 public function admin_directory_states( $states = array(), $post = null ) {1043 $bp = buddypress();1044 1045 if ( isset( $bp->pages->members->id ) && (int) $bp->pages->members->id === (int) $post->ID ) {1046 $states['page_for_members_directory'] = _x( 'BP Members Page', 'page label', 'buddypress' );1047 }1048 1049 if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) {1050 if ( isset( $bp->pages->register->id ) && (int) $bp->pages->register->id === (int) $post->ID ) {1051 $states['page_for_bp_registration'] = _x( 'BP Registration Page', 'page label', 'buddypress' );1052 }1053 1054 if ( isset( $bp->pages->activate->id ) && (int) $bp->pages->activate->id === (int) $post->ID ) {1055 $states['page_for_bp_activation'] = _x( 'BP Activation Page', 'page label', 'buddypress' );1056 }1057 }1058 1059 return parent::admin_directory_states( $states, $post );1060 }1061 1032 } -
trunk/src/bp-templates/bp-nouveau/includes/template-tags.php
r13443 r13471 4 4 * 5 5 * @since 3.0.0 6 * @version 1 0.0.06 * @version 12.0.0 7 7 */ 8 8 … … 1037 1037 1038 1038 if ( 'directory' === $bp_nouveau->displayed_nav ) { 1039 $scope = array( 'data-bp-scope' => $nav_item->slug ); 1039 $scope = array( 1040 'data-bp-scope' => $nav_item->slug 1041 ); 1040 1042 1041 1043 } elseif ( 'personal' === $bp_nouveau->displayed_nav && ! empty( $nav_item->secondary ) ) { 1042 $scope = array( 'data-bp-user-scope' => $nav_item->slug ); 1044 $rewrite_id = bp_rewrites_get_custom_slug_rewrite_id( 'members', $nav_item->slug, bp_current_component() ); 1045 $user_scope = $nav_item->slug; 1046 1047 if ( $rewrite_id ) { 1048 $user_scope = str_replace( 1049 array( 'bp_member_' . bp_current_component() . '_', '_' ), 1050 array( '', '-' ), 1051 $rewrite_id 1052 ); 1053 } 1054 1055 $scope = array( 1056 'data-bp-user-scope' => $nav_item->slug 1057 ); 1043 1058 1044 1059 } else { -
trunk/src/bp-xprofile/bp-xprofile-functions.php
r13395 r13471 757 757 } 758 758 } 759 add_action( 'bp_ setup_globals', 'xprofile_override_user_fullnames', 100 );759 add_action( 'bp_parse_query', 'xprofile_override_user_fullnames', 100 ); 760 760 761 761 /**
Note: See TracChangeset
for help on using the changeset viewer.