#4755 closed defect (bug) (fixed)
Address usage of bp_locate_template()
Reported by: | r-a-y | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 1.7 | Priority: | normal |
Severity: | normal | Version: | 1.7 |
Component: | Core | Keywords: | |
Cc: | rogercoathup |
Description (last modified by )
Let's try this again.
One-line summary:
bp_locate_template()
does not mirror the same set of templates as bp_get_template_part()
.
Side-effects:
Currently, bp_locate_template()
does not check a theme's custom subdirectories ('buddypress', 'community' ) for templates.
This is a problem when theme compat is on as bp-legacy's templates are located in the 'buddypress' subdirectory.
The main issue is bp_locate_template()
is used in these two functions:
- bp_has_custom_signup_page()
- bp_has_custom_activation_page()
Since bp_locate_template() is used in these functions, when theme compat is on, this leads to the registration / activation templates not being properly detected and hence the registration hijack that BP usually does fails.
Why do bp_locate_template() and bp_get_template_part() reference different templates?
It's due to this:
add_filter( 'bp_locate_template', 'bp_add_template_locations' ); add_filter( 'bp_get_template_part', 'bp_add_template_locations' );
The 'bp_locate_template' filter does not exist and was removed in r6537.
This leads to the registration / activation templates not being detected properly when theme compat is on.
Conclusion
We need a solution so both bp_locate_template() and bp_get_template_part() references the same templates at all times.
Some potential methods include:
- Adding back the
'bp_locate_template'
filter that was removed in r6537. - Adding the custom subdirectory locations at the template stack level. Attached patch is an attempt at this.
Attachments (1)
Change History (11)
#1
@
12 years ago
- Summary changed from Template stack: Address usage of bp_locate_template() to Address usage of bp_locate_template()
#6
@
12 years ago
As for (b), if we're really concerned about redundancy, then we should remove the filter in bp_get_template_part() and reinstate the filter in bp_locate_template(). Then we'd only have to run bp_add_template_locations() in one place, at the very end of the process.
I don't mind this approach as we should only run bp_add_template_locations()
once.
#7
@
12 years ago
- Keywords needs-refresh added; dev-feedback has-patch removed
- Owner set to johnjamesjacoby
- Status changed from new to assigned
Meee!
template_stack.01.patch seems like it just duplicates the work done by
bp_add_template_locations()
. If we can fix this problem (which clearly *is* a problem, as you've described it above - thanks for the clarification) without repeating ourselves, we should do so. So your strategy 1 seems better.Will there be negative consequences to adding the
bp_locate_template
filter? Looking at the code, I'm guessing that there are two big reasons for removing the filter in r6537:a) WP's core template loading functions don't have corresponding filters in their template loading functions (side note - it's this missing feature in WP that makes half of the theme compat code necessary. Grr)
b) It's assumed that
bp_locate_template()
will generally only be called within the context ofbp_get_template_part()
, and there's already a perfectly good filter in the latter function, so the latter filter seems redundant.IMO, (a) is a bad reason for us to omit a filter.
As for (b), if we're really concerned about redundancy, then we should remove the filter in
bp_get_template_part()
and reinstate the filter inbp_locate_template()
. Then we'd only have to runbp_add_template_locations()
in one place, at the very end of the process.My vote is to re-add the
bp_locate_template
filter and call it good enough, unless there's something I'm missing.