Skip to:
Content

BuddyPress.org

Ticket #8133: 8133.patch

File 8133.patch, 7.0 KB (added by imath, 7 years ago)
  • 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..82b825575 100644
     
    88?>
    99<div class="subnav-filters filters no-ajax" id="subnav-filters">
    1010
    11         <?php if ( 'friends' !== bp_current_component() ) : ?>
     11        <?php if ( bp_nouveau_get_component_slug( 'friends' ) !== bp_current_component() ) : ?>
    1212        <div class="subnav-search clearfix">
    1313
    14                 <?php if ( 'activity' === bp_current_component() ) : ?>
     14                <?php if ( bp_nouveau_get_component_slug( 'activity' ) === bp_current_component() ) : ?>
    1515                        <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>
    1616                <?php endif; ?>
    1717
     
    2222
    2323                <?php if ( bp_is_user() && ! bp_is_current_action( 'requests' ) ) : ?>
    2424                        <?php bp_get_template_part( 'common/filters/user-screens-filters' ); ?>
    25                 <?php elseif ( 'groups' === bp_current_component() ) : ?>
     25                <?php elseif ( bp_nouveau_get_component_slug( 'groups' ) === bp_current_component() ) : ?>
    2626                        <?php bp_get_template_part( 'common/filters/groups-screens-filters' ); ?>
    2727                <?php else : ?>
    2828                        <?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 a4cd20aa8..305b3d664 100644
    function bp_nouveau_get_component_filters( $context = '', $component = '' ) {  
    535535                if ( 'directory' === $context || 'user' === $context ) {
    536536                        $component = bp_current_component();
    537537
    538                         if ( 'friends' === $component ) {
     538                        if ( bp_nouveau_get_component_slug( 'friends' ) === $component ) {
    539539                                $context   = 'friends';
    540540                                $component = 'members';
    541541                        }
    function bp_nouveau_get_component_filters( $context = '', $component = '' ) {  
    550550                return $filters;
    551551        }
    552552
    553         if ( 'members' === $component ) {
     553        if ( bp_nouveau_get_component_slug( 'members' ) === $component ) {
    554554                $filters = bp_nouveau_get_members_filters( $context );
    555         } elseif ( 'activity' === $component ) {
     555        } elseif ( bp_nouveau_get_component_slug( 'activity' ) === $component ) {
    556556                $filters = bp_nouveau_get_activity_filters();
    557557
    558558                // Specific case for the activity dropdown
    559559                $filters = array_merge( array( '-1' => __( '&mdash; Everything &mdash;', 'buddypress' ) ), $filters );
    560         } elseif ( 'groups' === $component ) {
     560        } elseif ( bp_nouveau_get_component_slug( 'groups' ) === $component ) {
    561561                $filters = bp_nouveau_get_groups_filters( $context );
    562         } elseif ( 'blogs' === $component ) {
     562        } elseif ( bp_nouveau_get_component_slug( 'blogs' ) === $component ) {
    563563                $filters = bp_nouveau_get_blogs_filters( $context );
    564564        }
    565565
    function bp_nouveau_set_nav_item_order( $nav = null, $order = array(), $parent_s  
    13771377
    13781378        return true;
    13791379}
     1380
     1381function bp_nouveau_get_component_slug( $component_id = '' ) {
     1382        $slug = '';
     1383
     1384        if ( ! $component_id ) {
     1385                return $slug;
     1386        }
     1387
     1388        $component_id = sanitize_key( $component_id );
     1389
     1390        if ( bp_is_active( $component_id ) ) {
     1391                $slug = call_user_func( 'bp_get_' . $component_id . '_slug' );
     1392        } elseif ( defined( 'BP_' . strtoupper( $component_id ) . '_SLUG' ) ) {
     1393                $slug = constant( 'BP_' . strtoupper( $component_id ) . '_SLUG' );
     1394        } else {
     1395                $slug = $component_id;
     1396        }
     1397
     1398        return $slug;
     1399}
  • 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 8662aa552..bd5d6524f 100644
    function bp_nouveau_current_object() {  
    19891989
    19901990        } else {
    19911991                $data_filter = bp_current_component();
    1992                 if ( 'friends' === $data_filter && bp_is_user_friend_requests() ) {
    1993                         $data_filter = 'friend_requests';
     1992                if ( bp_nouveau_get_component_slug( 'friends' ) === $data_filter ) {
     1993                        $data_filter = 'friends';
     1994
     1995                        if ( bp_is_user_friend_requests() ) {
     1996                                $data_filter = 'friend_requests';
     1997                        }
    19941998                }
    19951999
    19962000                $component['members_select']   = 'members-order-select';
    function bp_nouveau_filter_container_id() {  
    20222026                $component = bp_nouveau_current_object();
    20232027
    20242028                $ids = array(
    2025                         'members'       =>  $component['members_select'],
    2026                         'friends'       => 'members-friends-select',
    2027                         'notifications' => 'notifications-filter-select',
    2028                         'activity'      => 'activity-filter-select',
    2029                         'groups'        => 'groups-order-select',
    2030                         'blogs'         => 'blogs-order-select',
     2029                        bp_nouveau_get_component_slug( 'members' )       =>  $component['members_select'],
     2030                        bp_nouveau_get_component_slug( 'friends' )       => 'members-friends-select',
     2031                        bp_nouveau_get_component_slug( 'notifications' ) => 'notifications-filter-select',
     2032                        bp_nouveau_get_component_slug( 'activity' )      => 'activity-filter-select',
     2033                        bp_nouveau_get_component_slug( 'groups' )        => 'groups-order-select',
     2034                        bp_nouveau_get_component_slug( 'blogs' )         => 'blogs-order-select',
    20312035                );
    20322036
    20332037                if ( isset( $ids[ $component['object'] ] ) ) {
    function bp_nouveau_filter_id() {  
    20652069                $component = bp_nouveau_current_object();
    20662070
    20672071                $ids = array(
    2068                         'members'       => $component['members_order_by'],
    2069                         'friends'       => 'members-friends',
    2070                         'notifications' => 'notifications-filter-by',
    2071                         'activity'      => 'activity-filter-by',
    2072                         'groups'        => 'groups-order-by',
    2073                         'blogs'         => 'blogs-order-by',
     2072                        bp_nouveau_get_component_slug( 'members' )       => $component['members_order_by'],
     2073                        bp_nouveau_get_component_slug( 'friends' )       => 'members-friends',
     2074                        bp_nouveau_get_component_slug( 'notifications' ) => 'notifications-filter-by',
     2075                        bp_nouveau_get_component_slug( 'activity' )      => 'activity-filter-by',
     2076                        bp_nouveau_get_component_slug( 'groups' )        => 'groups-order-by',
     2077                        bp_nouveau_get_component_slug( 'blogs' )         => 'blogs-order-by',
    20742078                );
    20752079
    20762080                if ( isset( $ids[ $component['object'] ] ) ) {
    function bp_nouveau_filter_label() {  
    21082112                $component = bp_nouveau_current_object();
    21092113                $label     = __( 'Order By:', 'buddypress' );
    21102114
    2111                 if ( 'activity' === $component['object'] || 'friends' === $component['object'] ) {
     2115                if ( bp_nouveau_get_component_slug( 'activity' ) === $component['object'] || bp_nouveau_get_component_slug( 'friends' ) === $component['object'] ) {
    21122116                        $label = __( 'Show:', 'buddypress' );
    21132117                }
    21142118
    function bp_nouveau_filter_options() {  
    21522156        function bp_nouveau_get_filter_options() {
    21532157                $output = '';
    21542158
    2155                 if ( 'notifications' === bp_current_component() ) {
     2159                if ( bp_nouveau_get_component_slug( 'notifications' ) === bp_current_component() ) {
    21562160                        $output = bp_nouveau_get_notifications_filters();
    21572161
    21582162                } else {