Changeset 12892
- Timestamp:
- 04/18/2021 10:18:06 AM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r12797 r12892 948 948 */ 949 949 return apply_filters( 'bp_core_get_component_search_query_arg', $query_arg, $component ); 950 } 951 952 /** 953 * Get a list of all active component objects. 954 * 955 * @since 8.0.0 956 * 957 * @param array $args { 958 * Optional. An array of key => value arguments to match against the component objects. 959 * Default empty array. 960 * 961 * @type string $name Translatable name for the component. 962 * @type string $id Unique ID for the component. 963 * @type string $slug Unique slug for the component, for use in query strings and URLs. 964 * @type bool $has_directory True if the component has a top-level directory. False otherwise. 965 * @type string $root_slug Slug used by the component's directory page. 966 * } 967 * @param string $output Optional. The type of output to return. Accepts 'ids' 968 * or 'objects'. Default 'ids'. 969 * @param string $operator Optional. The logical operation to perform. 'or' means only one 970 * element from the array needs to match; 'and' means all elements 971 * must match. Accepts 'or' or 'and'. Default 'and'. 972 * @return array A list of component ids or objects. 973 */ 974 function bp_core_get_active_components( $args = array(), $output = 'ids', $operator = 'and' ) { 975 $bp = buddypress(); 976 977 $active_components = array_keys( $bp->active_components ); 978 979 $xprofile_id = array_search( 'xprofile', $active_components, true ); 980 if ( false !== $xprofile_id ) { 981 $active_components[ $xprofile_id ] = 'profile'; 982 } 983 984 $components = array(); 985 foreach ( $active_components as $id ) { 986 if ( isset( $bp->{$id} ) && $bp->{$id} instanceof BP_Component ) { 987 $components[ $id ] = $bp->{$id}; 988 } 989 } 990 991 $components = wp_filter_object_list( $components, $args, $operator ); 992 993 if ( 'ids' === $output ) { 994 $components = wp_list_pluck( $components, 'id' ); 995 } 996 997 return $components; 950 998 } 951 999 -
trunk/src/bp-members/bp-members-adminbar.php
r12495 r12892 103 103 'id' => $bp->user_admin_menu_id . '-edit-profile', 104 104 'title' => __( "Edit Profile", 'buddypress' ), 105 'href' => bp_get_members_component_link( 'profile', 'edit' )105 'href' => bp_get_members_component_link( $bp->profile->id, 'edit' ) 106 106 ) ); 107 107 … … 112 112 'id' => $bp->user_admin_menu_id . '-change-avatar', 113 113 'title' => __( "Edit Profile Photo", 'buddypress' ), 114 'href' => bp_get_members_component_link( 'profile', 'change-avatar' )114 'href' => bp_get_members_component_link( $bp->profile->id, 'change-avatar' ) 115 115 ) ); 116 116 } … … 122 122 'id' => $bp->user_admin_menu_id . '-change-cover-image', 123 123 'title' => __( 'Edit Cover Image', 'buddypress' ), 124 'href' => bp_get_members_component_link( 'profile', 'change-cover-image' )124 'href' => bp_get_members_component_link( $bp->profile->id, 'change-cover-image' ) 125 125 ) ); 126 126 } -
trunk/src/bp-members/bp-members-template.php
r12799 r12892 2801 2801 */ 2802 2802 function bp_get_members_component_link( $component, $action = '', $query_args = '', $nonce = false ) { 2803 2804 2803 // Must be displayed user. 2805 if ( ! bp_displayed_user_id() )2804 if ( ! bp_displayed_user_id() ) { 2806 2805 return; 2806 } 2807 2807 2808 2808 $bp = buddypress(); 2809 2809 2810 if ( 'xprofile' === $component ) { 2811 $component = 'profile'; 2812 } 2813 2810 2814 // Append $action to $url if there is no $type. 2811 if ( ! empty( $action ) )2815 if ( ! empty( $action ) ) { 2812 2816 $url = bp_displayed_user_domain() . $bp->{$component}->slug . '/' . $action; 2813 else2817 } else { 2814 2818 $url = bp_displayed_user_domain() . $bp->{$component}->slug; 2819 } 2815 2820 2816 2821 // Add a slash at the end of our user url. … … 2818 2823 2819 2824 // Add possible query arg. 2820 if ( ! empty( $query_args ) && is_array( $query_args ) )2825 if ( ! empty( $query_args ) && is_array( $query_args ) ) { 2821 2826 $url = add_query_arg( $query_args, $url ); 2827 } 2822 2828 2823 2829 // To nonce, or not to nonce... 2824 if ( true === $nonce ) 2830 if ( true === $nonce ) { 2825 2831 $url = wp_nonce_url( $url ); 2826 elseif ( is_string( $nonce ) )2832 } elseif ( is_string( $nonce ) ) { 2827 2833 $url = wp_nonce_url( $url, $nonce ); 2834 } 2828 2835 2829 2836 // Return the url, if there is one. 2830 if ( ! empty( $url ) )2837 if ( ! empty( $url ) ) { 2831 2838 return $url; 2839 } 2832 2840 } 2833 2841 -
trunk/src/bp-members/classes/class-bp-members-component.php
r12771 r12892 315 315 $access = bp_core_can_edit_settings(); 316 316 $slug = bp_get_profile_slug(); 317 $profile_link = bp_get_members_component_link( $slug);317 $profile_link = bp_get_members_component_link( buddypress()->profile->id ); 318 318 319 319 // Change Avatar. -
trunk/src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php
r12156 r12892 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 8.0.0 7 7 */ 8 8 ?> 9 9 <div class="subnav-filters filters no-ajax" id="subnav-filters"> 10 10 11 <?php if ( 'friends'!== bp_current_component() ) : ?>12 <div class="subnav-search clearfix">11 <?php if ( bp_get_friends_slug() !== bp_current_component() ) : ?> 12 <div class="subnav-search clearfix"> 13 13 14 <?php if ( 'activity'=== bp_current_component() ) : ?>15 <div class="feed"><a href="<?php bp_sitewide_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><span class="bp-screen-reader-text"><?php esc_html_e( 'RSS', 'buddypress' ); ?></span></a></div>16 <?php endif; ?>14 <?php if ( bp_get_activity_slug() === bp_current_component() ) : ?> 15 <div class="feed"><a href="<?php bp_sitewide_activity_feed_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'RSS Feed', 'buddypress' ); ?>"><span class="bp-screen-reader-text"><?php esc_html_e( 'RSS', 'buddypress' ); ?></span></a></div> 16 <?php endif; ?> 17 17 18 <?php bp_nouveau_search_form(); ?>18 <?php bp_nouveau_search_form(); ?> 19 19 20 </div>20 </div> 21 21 <?php endif; ?> 22 22 23 23 <?php if ( bp_is_user() && ! bp_is_current_action( 'requests' ) ) : ?> 24 24 <?php bp_get_template_part( 'common/filters/user-screens-filters' ); ?> 25 <?php elseif ( 'groups'=== bp_current_component() ) : ?>25 <?php elseif ( bp_get_groups_slug() === bp_current_component() ) : ?> 26 26 <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?> 27 27 <?php else : ?> -
trunk/src/bp-templates/bp-nouveau/includes/functions.php
r12595 r12892 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 8.0.0 7 7 */ 8 8 … … 238 238 */ 239 239 function bp_nouveau_wrapper( $args = array() ) { 240 /** 241 * Classes need to be determined & set by component to a certain degree 242 * 243 * Check the component to find a default container_class to add 244 */ 245 $current_component_class = bp_current_component() . '-meta'; 240 /** 241 * Classes need to be determined & set by component to a certain degree. 242 * 243 * Check the component to find a default container_class based on the component ID to add. 244 * We need to to this because bp_current_component() is using the component slugs which can differ 245 * from the component ID. 246 */ 247 $current_component_id = bp_core_get_active_components( array( 'slug' => bp_current_component() ) ); 248 if ( $current_component_id && 1 === count( $current_component_id ) ) { 249 $current_component_id = reset( $current_component_id ); 250 } else { 251 $current_component_id = bp_current_component(); 252 } 253 254 $current_component_class = $current_component_id . '-meta'; 246 255 247 256 if ( bp_is_group_activity() ) { … … 256 265 'container' => 'div', 257 266 'container_id' => '', 258 'container_classes' => array( $generic_class, $current_component_class 267 'container_classes' => array( $generic_class, $current_component_class ), 259 268 'output' => '', 260 269 ), … … 533 542 534 543 if ( empty( $component ) ) { 535 if ( 'directory' === $context || 'user' === $context ) { 536 $component = bp_current_component(); 544 if ( 'user' === $context ) { 545 $component = bp_core_get_active_components( array( 'slug' => bp_current_component() ) ); 546 $component = reset( $component ); 537 547 538 548 if ( 'friends' === $component ) { … … 544 554 } elseif ( 'group' === $context && bp_is_group_members() ) { 545 555 $component = 'members'; 556 } else { 557 $component = bp_current_component(); 546 558 } 547 559 } -
trunk/src/bp-templates/bp-nouveau/includes/template-tags.php
r12887 r12892 4 4 * 5 5 * @since 3.0.0 6 * @version 7.0.06 * @version 8.0.0 7 7 */ 8 8 … … 2069 2069 2070 2070 } else { 2071 $data_filter = bp_current_component(); 2071 $component_id = bp_current_component(); 2072 if ( ! bp_is_directory() ) { 2073 $component_id = bp_core_get_active_components( array( 'slug' => $component_id ) ); 2074 $component_id = reset( $component_id ); 2075 } 2076 2077 $data_filter = $component_id; 2078 2072 2079 if ( 'friends' === $data_filter && bp_is_user_friend_requests() ) { 2073 2080 $data_filter = 'friend_requests'; … … 2076 2083 $component['members_select'] = 'members-order-select'; 2077 2084 $component['members_order_by'] = 'members-order-by'; 2078 $component['object'] = bp_current_component();2085 $component['object'] = $component_id; 2079 2086 $component['data_filter'] = $data_filter; 2080 2087 } … … 2233 2240 $output = ''; 2234 2241 2235 if ( 'notifications'=== bp_current_component() ) {2242 if ( bp_get_notifications_slug() === bp_current_component() ) { 2236 2243 $output = bp_nouveau_get_notifications_filters(); 2237 2244
Note: See TracChangeset
for help on using the changeset viewer.