Skip to:
Content

BuddyPress.org

Changes between Initial Version and Version 3 of Ticket #4755


Ignore:
Timestamp:
01/16/2013 07:50:02 PM (11 years ago)
Author:
r-a-y
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4755

    • Property Cc rogercoathup added
    • Property Summary changed from Template stack: Address usage of bp_locate_template() to Address usage of bp_locate_template()
  • Ticket #4755 – Description

    initial v3  
    1 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()`.
     1Let's try this again.
    22
    3 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()`.
     3'''One-line summary:'''
     4`bp_locate_template()` does not mirror the same set of templates as `bp_get_template_part()`.
    45
    5 This leads to issues with the "Register" links in both single and multisite as BP does not hijack them as in previous BP releases.
     6'''Side-effects:'''
     7Currently, `bp_locate_template()` does not check a theme's custom subdirectories ('buddypress', 'community' ) for templates.
    68
    7 ----
     9This is a problem when theme compat is on as bp-legacy's templates are located in the 'buddypress' subdirectory.
    810
    9 I listed a potential solution in the second patch of #4656.
     11The main issue is `bp_locate_template()` is used in these two functions:
    1012
    11 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.
     13* bp_has_custom_signup_page()
     14* bp_has_custom_activation_page()
    1215
    13 Let me know if I'm not being clear.
     16Since 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.
     17
     18'''Why do bp_locate_template() and bp_get_template_part() reference different templates?'''
     19It's due to this:
     20
     21{{{
     22add_filter( 'bp_locate_template',   'bp_add_template_locations' );
     23add_filter( 'bp_get_template_part', 'bp_add_template_locations' );
     24}}}
     25
     26The 'bp_locate_template' filter does not exist and was removed in r6537.
     27
     28This leads to the registration / activation templates are not detected properly when theme compat is on.
     29
     30'''Conclusion'''
     31We need a solution so both bp_locate_template() and bp_get_template_part() references the same templates at all times.
     32
     33Some potential methods include:
     34
     351. Adding back the `'bp_locate_template'` filter that was removed in r6537.
     362. Adding the custom subdirectory locations at the template stack level.  Attached patch is an attempt at this.