Skip to:
Content

BuddyPress.org

Ticket #6649: 6649.diff

File 6649.diff, 1.3 KB (added by boonebgorges, 10 years ago)
  • src/bp-core/bp-core-template-loader.php

    diff --git src/bp-core/bp-core-template-loader.php src/bp-core/bp-core-template-loader.php
    index 46ef7a6..09e79c5 100644
    function bp_get_template_stack() { 
    212212        $wp_current_filter[] = $tag;
    213213
    214214        // Sort
    215         if ( ! isset( $merged_filters[ $tag ] ) ) {
    216                 ksort( $wp_filter[$tag] );
    217                 $merged_filters[ $tag ] = true;
     215        if ( class_exists( 'WP_Hook' ) ) {
     216                $filter = $wp_filter[ $tag ]->callbacks;
     217        } else {
     218                $filter = &$wp_filter[ $tag ];
     219
     220                if ( ! isset( $merged_filters[ $tag ] ) ) {
     221                        ksort( $filter );
     222                        $merged_filters[ $tag ] = true;
     223                }
    218224        }
    219225
    220226        // Ensure we're always at the beginning of the filter array
    221         reset( $wp_filter[ $tag ] );
     227        reset( $filter );
    222228
    223229        // Loop through 'bp_template_stack' filters, and call callback functions
    224230        do {
    225                 foreach( (array) current( $wp_filter[$tag] ) as $the_ ) {
     231                foreach( (array) current( $filter ) as $the_ ) {
    226232                        if ( ! is_null( $the_['function'] ) ) {
    227233                                $args[1] = $stack;
    228234                                $stack[] = call_user_func_array( $the_['function'], array_slice( $args, 1, (int) $the_['accepted_args'] ) );
    229235                        }
    230236                }
    231         } while ( next( $wp_filter[$tag] ) !== false );
     237        } while ( next( $filter ) !== false );
    232238
    233239        // Remove 'bp_template_stack' from the current filter array
    234240        array_pop( $wp_current_filter );