[buddypress-trac] [BuddyPress] #4656: Theme Compat: Port over new bbPress template stack functionality

buddypress-trac noreply at wordpress.org
Fri Nov 9 19:57:37 UTC 2012


#4656: Theme Compat: Port over new bbPress template stack functionality
--------------------------+------------------------------------
 Reporter:  r-a-y         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  1.7
Component:  Core          |    Version:  1.7
 Severity:  major         |   Keywords:  has-patch dev-feedback
--------------------------+------------------------------------
 r6490 introduced a fix to override template parts in BP's custom directory
 locations.

 For example, I want to override `/members/single/member-header.php` and
 place it in /wp-
 content/themes/twentytwelve/'''buddypress'''/members/single/member-
 header.php

 Before r6490, this wasn't possible.

 However, JJJ noted that bbPress introduced the new method of the template
 stack in [BB4324], which is more flexible for developers and we should
 look into using that instead.

 ----

 The first patch does this verbatim and, indeed, addresses what is noted
 above.

 ----

 However, I've also attached a second patch, which includes the first patch
 plus a fix when using `bp_locate_template()` by itself.

 If you used `bp_locate_template()` by itself, it would not use the custom
 directory locations as set in `bp_get_template_locations()` because only
 `bp_get_template_part()` has a filter that is hooked in by
 `bp_add_template_locations()`.

 Second patch removes this:

 `add_filter( 'bp_get_template_part',  'bp_add_template_locations' );`

 And hooks into the later-running filter, `'bp_get_template_stack'`, to add
 the custom directory locations.

 This fixes problems when using such functions as
 `bp_has_custom_signup_page()` and `bp_has_custom_activation_page()`, which
 both rely on `bp_locate_template()`.

 If the second patch is not deemed acceptable, what we need is an approach
 that makes sure both `bp_get_template_part()` and `bp_locate_template()`
 references the same templates at all times.

 Feedback welcome.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4656>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list