[buddypress-trac] [BuddyPress Trac] #6190: Custom page template needs to be validated before using it in template stack

buddypress-trac noreply at wordpress.org
Sun Feb 8 20:54:17 UTC 2015

#6190: Custom page template needs to be validated before using it in template
 Reporter:  r-a-y                       |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  2.2.1
Component:  Appearance - Template Pack  |     Version:  2.2
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch                   |

Comment (by r-a-y):

 > This doesn't seem like it's necessary, or else the array_unshift() bit
 or the bp_get_buddypress_template filter are not working correctly.

 It is necessary when a custom page template does not have a valid header.
 But, this is more of an edge case since, as you say, the template should
 be validated when WP saves the page.

 > Did none of those files exist, or was that function or filter unhooked
 or overridden?

 No filters unhooked.


 I took a closer look and the `_wp_page_template` value was
 `activity/index.php`.  Did some digging and found that as of BP 1.5 and in
 bp-default, we deemed the activity directory page as a WP custom page

 On this particular install, the admin must have selected this page
 template.  Fast-forward to 2.2 and this bug creeps up when the install has
 moved onto theme compatibility.

 What happens is BP goes through the template stack and does find the
 template file in `/bp-legacy/buddypress/activity/index.php`.  But this
 template file is a template part and not a real page template.

 So the end result is BP just loads the template part without a wrapper

 I get that `WP_Theme::get_page_templates()` is costly, but we kind of are
 at fault here because of our template headers in bp-default.  This could
 be a lingering and annoying issue, so I've opted for a less-costly fix in

 Let me know what you think.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6190#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list