Skip to:
Content

BuddyPress.org

Changeset 12837


Ignore:
Timestamp:
01/22/2021 06:38:09 PM (4 years ago)
Author:
imath
Message:

Nouveau: Apply columns preference when Groups loop is filtered by type

Using the customizer you can define your preferences about the number of columns the BP Nouveau Template Pack should use to display Groups into their directory page. This preference needs to also be applied when this directory page is only listing Groups matching a specific type.

Props vapvarun

Fixes #8427 (branch 7.0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/7.0/src/bp-templates/bp-nouveau/includes/template-tags.php

    r12814 r12837  
    548548
    549549        // @todo: this function could do with passing args so we can pass simple strings in or array of strings
     550        $is_directory = bp_is_directory();
    550551
    551552        // The $component is faked if it's the single group member loop
    552         if ( ! bp_is_directory() && ( bp_is_group() && 'members' === bp_current_action() ) ) {
     553        if ( ! $is_directory && ( bp_is_group() && 'members' === bp_current_action() ) ) {
    553554            $component = 'members_group';
    554         } elseif ( ! bp_is_directory() && ( bp_is_user() && 'my-friends' === bp_current_action() ) ) {
     555        } elseif ( ! $is_directory && ( bp_is_user() && 'my-friends' === bp_current_action() ) ) {
    555556            $component = 'members_friends';
    556557        } else {
    557558            $component = sanitize_key( bp_current_component() );
     559        }
     560
     561        /*
     562         * For the groups component, we need to take in account the
     563         * Groups directory can list Groups according to a Group Type.
     564         */
     565        if ( 'groups' === $component ) {
     566            $is_directory = bp_is_groups_directory();
    558567        }
    559568
     
    585594
    586595        // Only the available components supports custom layouts.
    587         if ( ! empty( $available_components[ $component ] ) && ( bp_is_directory() || bp_is_group() || bp_is_user() ) ) {
     596        if ( ! empty( $available_components[ $component ] ) && ( $is_directory || bp_is_group() || bp_is_user() ) ) {
    588597            $customizer_option = sprintf( '%s_layout', $component );
    589598            $layout_prefs      = bp_nouveau_get_temporary_setting(
Note: See TracChangeset for help on using the changeset viewer.