Skip to:
Content

BuddyPress.org

Changeset 10891


Ignore:
Timestamp:
06/21/2016 07:16:38 PM (8 years ago)
Author:
dcavins
Message:

Add group-type-specific template to group front template hierarchy.

Add front-group-type-{type}.php template to group front template
hierarchy stack. Order of stack is now id, slug, type, status
and front.

Props imath.

Fixes #7129.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r10847 r10891  
    41874187 *
    41884188 * @since 2.4.0
     4189 * @since 2.6.0 Adds the Group Type to the front template hierarchy.
    41894190 *
    41904191 * @param  BP_Groups_Group|null $group Optional. Falls back to current group if not passed.
     
    42044205    }
    42054206
    4206     /**
    4207      * Filters the hierarchy of group front templates corresponding to a specific group.
    4208      *
    4209      * @since 2.4.0
    4210      * @since 2.5.0 Added the `$group` parameter.
    4211      *
    4212      * @param array  $template_names Array of template paths.
    4213      * @param object $group          Group object.
    4214      */
    4215     $template_names = apply_filters( 'bp_groups_get_front_template', array(
     4207    $template_names = array(
    42164208        'groups/single/front-id-'     . sanitize_file_name( $group->id )     . '.php',
    42174209        'groups/single/front-slug-'   . sanitize_file_name( $group->slug )   . '.php',
     4210    );
     4211
     4212    if ( bp_groups_get_group_types() ) {
     4213        $group_type = bp_groups_get_group_type( $group->id );
     4214        if ( ! $group_type ) {
     4215            $group_type = 'none';
     4216        }
     4217
     4218        $template_names[] = 'groups/single/front-group-type-' . sanitize_file_name( $group_type )   . '.php';
     4219    }
     4220
     4221    $template_names = array_merge( $template_names, array(
    42184222        'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php',
    42194223        'groups/single/front.php'
    42204224    ) );
    42214225
    4222     return bp_locate_template( $template_names, false, true );
     4226    /**
     4227     * Filters the hierarchy of group front templates corresponding to a specific group.
     4228     *
     4229     * @since 2.4.0
     4230     * @since 2.5.0 Added the `$group` parameter.
     4231     *
     4232     * @param array  $template_names Array of template paths.
     4233     * @param object $group          Group object.
     4234     */
     4235    return bp_locate_template( apply_filters( 'bp_groups_get_front_template', $template_names, $group ), false, true );
    42234236}
    42244237
Note: See TracChangeset for help on using the changeset viewer.