Ticket #8133: 8133.2.patch
| File 8133.2.patch, 11.8 KB (added by , 5 years ago) |
|---|
-
src/bp-core/bp-core-functions.php
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php index 592f5b155..3563f5f5a 100644
function bp_core_get_component_search_query_arg( $component = null ) { 949 949 return apply_filters( 'bp_core_get_component_search_query_arg', $query_arg, $component ); 950 950 } 951 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; 998 } 999 952 1000 /** 953 1001 * Determine whether BuddyPress should register the bp-themes directory. 954 1002 * -
src/bp-members/bp-members-adminbar.php
diff --git src/bp-members/bp-members-adminbar.php src/bp-members/bp-members-adminbar.php index 28b6f54c3..10f784d09 100644
function bp_members_admin_bar_user_admin_menu() { 102 102 'parent' => $bp->user_admin_menu_id, 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 108 108 // User Admin > Edit this user's avatar. … … function bp_members_admin_bar_user_admin_menu() { 111 111 'parent' => $bp->user_admin_menu_id, 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 } 117 117 … … function bp_members_admin_bar_user_admin_menu() { 121 121 'parent' => $bp->user_admin_menu_id, 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 } 127 127 -
src/bp-members/bp-members-template.php
diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php index 5ceda3078..541b27479 100644
function bp_members_component_link( $component, $action = '', $query_args = '', 2800 2800 * @return string 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. 2817 2822 $url = trailingslashit( $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 2834 2842 -
src/bp-members/classes/class-bp-members-component.php
diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php index 77777d645..9e6fbcd42 100644
class BP_Members_Component extends BP_Component { 314 314 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. 320 320 if ( buddypress()->avatar->show_avatars ) { -
src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php
diff --git src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php src/bp-templates/bp-nouveau/buddypress/common/search-and-filters-bar.php index 20441b2f3..d07d70cfb 100644
3 3 * BP Nouveau Search & filters bar 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 : ?> 28 28 <?php bp_get_template_part( 'common/filters/directory-filters' ); ?> -
src/bp-templates/bp-nouveau/includes/functions.php
diff --git src/bp-templates/bp-nouveau/includes/functions.php src/bp-templates/bp-nouveau/includes/functions.php index 25b9af487..69a72e110 100644
3 3 * Common functions 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 8.0.0 7 7 */ 8 8 9 9 // Exit if accessed directly. … … function bp_nouveau_ajax_button( $output = '', $button = null, $before = '', $af 237 237 * } 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() ) { 248 257 $generic_class = ' activity-meta '; … … function bp_nouveau_wrapper( $args = array() ) { 255 264 array( 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 ), 261 270 'nouveau_wrapper' … … function bp_nouveau_get_component_filters( $context = '', $component = '' ) { 532 541 } 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 ) { 539 549 $context = 'friends'; … … function bp_nouveau_get_component_filters( $context = '', $component = '' ) { 543 553 $component = 'activity'; 544 554 } elseif ( 'group' === $context && bp_is_group_members() ) { 545 555 $component = 'members'; 556 } else { 557 $component = bp_current_component(); 546 558 } 547 559 } 548 560 -
src/bp-templates/bp-nouveau/includes/template-tags.php
diff --git src/bp-templates/bp-nouveau/includes/template-tags.php src/bp-templates/bp-nouveau/includes/template-tags.php index 5ee755a05..e195c22a5 100644
3 3 * Common template tags 4 4 * 5 5 * @since 3.0.0 6 * @version 7.0.06 * @version 8.0.0 7 7 */ 8 8 9 9 // Exit if accessed directly. … … function bp_nouveau_current_object() { 2068 2068 } 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'; 2074 2081 } 2075 2082 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 } 2081 2088 … … function bp_nouveau_filter_options() { 2232 2239 function bp_nouveau_get_filter_options() { 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 2238 2245 } else {
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)