Skip to:
Content

BuddyPress.org

Ticket #7129: 7129.patch

File 7129.patch, 2.2 KB (added by imath, 8 years ago)
  • src/bp-groups/bp-groups-template.php

    diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
    index be28ded..f8f7986 100644
    function bp_groups_front_template_part() { 
    41864186 * Locate a custom group front template if it exists.
    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.
    41914192 * @return string|bool                 Path to front template on success; boolean false on failure.
    function bp_groups_get_front_template( $group = null ) { 
    42034204                return $group->front_template;
    42044205        }
    42054206
     4207        $template_names = array(
     4208                'groups/single/front-id-'     . sanitize_file_name( $group->id )     . '.php',
     4209                '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(
     4222                'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php',
     4223                'groups/single/front.php'
     4224        ) );
     4225
    42064226        /**
    42074227         * Filters the hierarchy of group front templates corresponding to a specific group.
    42084228         *
    function bp_groups_get_front_template( $group = null ) { 
    42124232         * @param array  $template_names Array of template paths.
    42134233         * @param object $group          Group object.
    42144234         */
    4215         $template_names = apply_filters( 'bp_groups_get_front_template', array(
    4216                 'groups/single/front-id-'     . sanitize_file_name( $group->id )     . '.php',
    4217                 'groups/single/front-slug-'   . sanitize_file_name( $group->slug )   . '.php',
    4218                 'groups/single/front-status-' . sanitize_file_name( $group->status ) . '.php',
    4219                 'groups/single/front.php'
    4220         ) );
    4221 
    4222         return bp_locate_template( $template_names, false, true );
     4235        return bp_locate_template( apply_filters( 'bp_groups_get_front_template', $template_names, $group ), false, true );
    42234236}
    42244237
    42254238/**