[buddypress-trac] [BuddyPress] #4755: Address usage of bp_locate_template()
noreply at wordpress.org
Wed Jan 16 19:50:02 UTC 2013
#4755: Address usage of bp_locate_template()
Reporter: r-a-y | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 1.7
Component: Core | Version: 1.7
Severity: normal | Resolution:
Keywords: dev-feedback |
Description changed by r-a-y:
> If you use `bp_locate_template()` by itself, it will not see the custom
> directory locations (like 'buddypress' and 'community' 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()`.
> This is a problem in the current codebase as
> `bp_has_custom_signup_page()` and `bp_has_custom_activation_page()` both
> use `bp_locate_template()`.
> This leads to issues with the "Register" links in both single and
> multisite as BP does not hijack them as in previous BP releases.
> I listed a potential solution in the second patch of #4656.
> If that approach is not acceptable, then I believe we'll need a method
> that makes sure both `bp_get_template_part()` and `bp_locate_template()`
> references the same templates at all times.
> Let me know if I'm not being clear.
Let's try this again.
`bp_locate_template()` does not mirror the same set of templates as
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:
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
'''Why do bp_locate_template() and bp_get_template_part() reference
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 are not detected
properly when theme compat is on.
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:
1. Adding back the `'bp_locate_template'` filter that was removed in
2. Adding the custom subdirectory locations at the template stack level.
Attached patch is an attempt at this.
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4755#comment:3>
More information about the buddypress-trac