Skip to:
Content

BuddyPress.org

Changeset 6780


Ignore:
Timestamp:
02/10/2013 11:57:50 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility:

  • When locating template files, filter 'bbp_get_template_stack' rather than 'bbp_get_template_part'
  • Fixes bug where using bbp_locate_template() directly would result in missing subdirectory locations.
  • Props r-a-y.
  • Fixes #4755.
Location:
trunk/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-filters.php

    r6589 r6780  
    5959 * bp_template_include() works and do something similar. :)
    6060 */
    61 add_filter( 'bp_template_include', 'bp_template_include_theme_supports', 2, 1 );
    62 add_filter( 'bp_template_include', 'bp_template_include_theme_compat',   4, 2 );
    63 
    64 // Run all template parts through additional template locations
    65 add_filter( 'bp_locate_template',   'bp_add_template_locations' );
    66 add_filter( 'bp_get_template_part', 'bp_add_template_locations' );
     61add_filter( 'bp_template_include',   'bp_template_include_theme_supports', 2, 1 );
     62add_filter( 'bp_template_include',   'bp_template_include_theme_compat',   4, 2 );
     63
     64// Filter BuddyPress template locations
     65add_filter( 'bp_get_template_stack', 'bp_add_template_locations'                );
    6766
    6867// Turn comments off for BuddyPress pages
  • trunk/bp-core/bp-core-template-loader.php

    r6667 r6780  
    279279 * @since BuddyPress (1.7)
    280280 *
    281  * @param array $templates
     281 * @param array $stacks
    282282 * @return array()
    283283 */
    284 function bp_add_template_locations( $templates = array() ) {
     284function bp_add_template_stack_locations( $stacks = array() ) {
    285285    $retval = array();
    286286
    287287    // Get alternate locations
    288     $locations = bp_get_template_locations( $templates );
    289 
    290     // Loop through locations and templates and combine
    291     foreach ( (array) $locations as $location )
    292         foreach ( (array) $templates as $template )
    293             $retval[] = ltrim( trailingslashit( $location ) . $template, '/' );
    294 
    295     return apply_filters( 'bp_add_template_locations', array_unique( $retval ), $templates );
     288    $locations = bp_get_template_locations();
     289
     290    // Loop through locations and stacks and combine
     291    foreach ( (array) $stacks as $stack )
     292        foreach ( (array) $locations as $custom_location )
     293            $retval[] = untrailingslashit( trailingslashit( $stack ) . $custom_location );
     294
     295    return apply_filters( 'bp_add_template_stack_locations', array_unique( $locations ), $stacks );
    296296}
    297297
Note: See TracChangeset for help on using the changeset viewer.