<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][7212] trunk: Introduces template hierarchy for top-level theme compat templates</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/7212">7212</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-06-13 01:27:01 +0000 (Thu, 13 Jun 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Introduces template hierarchy for top-level theme compat templates
The "top-level" template is the outermost template included by theme
compatibility. As of BuddyPress 1.7, a stack of template names is checked when
BP decides which top-level template to use: plugin-buddypres.php,
buddypress.php, community.php, etc. (See bp_get_theme_compat_templates().)
This changeset introduces an additional level of template hierarchy, so that
themes may provide top-level templates that are specific to the current
component, such as blogs/index-directory.php, or specific to the current item,
action, or status, such as groups/single/index-id-{$group_id}.php. In this way,
BP's top-level template hierarchy becomes more flexible for theme devs, and
more closely parallels the template hierarchy used by WordPress.
Note that this changeset only implements hierarchy for the top-level templates.
Inner template parts may receive a parallel hierarchy in a future version of
BuddyPress.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/4639">#4639</a>
Props r-a-y</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityscreensphp">trunk/bp-activity/bp-activity-screens.php</a></li>
<li><a href="#trunkbpblogsbpblogsscreensphp">trunk/bp-blogs/bp-blogs-screens.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsscreensphp">trunk/bp-groups/bp-groups-screens.php</a></li>
<li><a href="#trunkbpmembersbpmembersscreensphp">trunk/bp-members/bp-members-screens.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityscreensphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-screens.php (7211 => 7212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-screens.php 2013-06-13 01:14:54 UTC (rev 7211)
+++ trunk/bp-activity/bp-activity-screens.php 2013-06-13 01:27:01 UTC (rev 7212)
</span><span class="lines">@@ -318,7 +318,7 @@
</span><span class="cx"> * The main theme compat class for BuddyPress Activity
</span><span class="cx"> *
</span><span class="cx"> * This class sets up the necessary theme compatability actions to safely output
</span><del>- * group template parts to the_title and the_content areas of a theme.
</del><ins>+ * activity template parts to the_title and the_content areas of a theme.
</ins><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="cx"> */
</span><span class="lines">@@ -350,11 +350,13 @@
</span><span class="cx">
</span><span class="cx"> do_action( 'bp_activity_screen_index' );
</span><span class="cx">
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
</span><span class="cx">
</span><span class="cx"> // Single activity
</span><span class="cx"> } elseif ( bp_is_single_activity() ) {
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) );
</span><span class="cx"> }
</span><span class="lines">@@ -363,6 +365,29 @@
</span><span class="cx"> /** Directory *************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add template hierarchy to theme compat for the activity directory page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function directory_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
+ 'activity/index-directory.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with directory data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -393,6 +418,29 @@
</span><span class="cx"> /** Single ****************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add custom template hierarchy to theme compat for activity permalink pages.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function single_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
+ 'activity/single/index.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with the displayed user's data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span></span></pre></div>
<a id="trunkbpblogsbpblogsscreensphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-screens.php (7211 => 7212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-screens.php 2013-06-13 01:14:54 UTC (rev 7211)
+++ trunk/bp-blogs/bp-blogs-screens.php 2013-06-13 01:27:01 UTC (rev 7212)
</span><span class="lines">@@ -86,11 +86,13 @@
</span><span class="cx">
</span><span class="cx"> do_action( 'bp_blogs_screen_index' );
</span><span class="cx">
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
</span><span class="cx">
</span><span class="cx"> // Create blog
</span><span class="cx"> } elseif ( is_user_logged_in() && bp_blog_signup_enabled() ) {
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) );
</span><span class="cx"> }
</span><span class="lines">@@ -99,6 +101,29 @@
</span><span class="cx"> /** Directory *************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add template hierarchy to theme compat for the blog directory page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function directory_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
+ 'blogs/index-directory.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with directory data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -137,6 +162,29 @@
</span><span class="cx"> /** Create ****************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add custom template hierarchy to theme compat for the blog create page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function create_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
+ 'blogs/index-create.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with create screen data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsscreensphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-screens.php (7211 => 7212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-screens.php 2013-06-13 01:14:54 UTC (rev 7211)
+++ trunk/bp-groups/bp-groups-screens.php 2013-06-13 01:27:01 UTC (rev 7212)
</span><span class="lines">@@ -971,16 +971,19 @@
</span><span class="cx">
</span><span class="cx"> do_action( 'groups_directory_groups_setup' );
</span><span class="cx">
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
</span><span class="cx">
</span><span class="cx"> // Creating a group
</span><span class="cx"> } elseif ( bp_is_groups_component() && bp_is_current_action( 'create' ) ) {
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) );
</span><span class="cx">
</span><del>- // Group admin
</del><ins>+ // Group page
</ins><span class="cx"> } elseif ( bp_is_single_item() ) {
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'single_content' ) );
</span><span class="cx">
</span><span class="lines">@@ -990,6 +993,29 @@
</span><span class="cx"> /** Directory *************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add template hierarchy to theme compat for the group directory page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function directory_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_groups_directory', array(
+ 'groups/index-directory.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with directory data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -1028,6 +1054,29 @@
</span><span class="cx"> /** Create ****************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add custom template hierarchy to theme compat for the group create page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function create_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array(
+ 'groups/index-create.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with create screen data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -1066,6 +1115,36 @@
</span><span class="cx"> /** Single ****************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add custom template hierarchy to theme compat for group pages.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function single_template_hierarchy( $templates ) {
+ // Setup some variables we're going to reference in our custom templates
+ $group = groups_get_current_group();
+
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array(
+ 'groups/single/index-id-' . sanitize_file_name( bp_get_current_group_id() ) . '.php',
+ 'groups/single/index-slug-' . sanitize_file_name( bp_get_current_group_slug() ) . '.php',
+ 'groups/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php',
+ 'groups/single/index-status-' . sanitize_file_name( $group->status ) . '.php',
+ 'groups/single/index.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with single group data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span></span></pre></div>
<a id="trunkbpmembersbpmembersscreensphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-screens.php (7211 => 7212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-screens.php 2013-06-13 01:14:54 UTC (rev 7211)
+++ trunk/bp-members/bp-members-screens.php 2013-06-13 01:27:01 UTC (rev 7212)
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx"> * The main theme compat class for BuddyPress Members.
</span><span class="cx"> *
</span><span class="cx"> * This class sets up the necessary theme compatability actions to safely output
</span><del>- * group template parts to the_title and the_content areas of a theme.
</del><ins>+ * member template parts to the_title and the_content areas of a theme.
</ins><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="cx"> */
</span><span class="lines">@@ -298,6 +298,7 @@
</span><span class="cx">
</span><span class="cx"> do_action( 'bp_members_screen_index' );
</span><span class="cx">
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
</span><span class="cx">
</span><span class="lines">@@ -310,6 +311,7 @@
</span><span class="cx">
</span><span class="cx"> do_action( 'bp_members_screen_display_profile' );
</span><span class="cx">
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) );
</span><span class="cx">
</span><span class="lines">@@ -319,6 +321,29 @@
</span><span class="cx"> /** Directory *************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add template hierarchy to theme compat for the members directory page.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function directory_template_hierarchy( $templates ) {
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_members_directory', array(
+ 'members/single/index-directory.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with directory data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -349,6 +374,36 @@
</span><span class="cx"> /** Single ****************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add custom template hierarchy to theme compat for member pages.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function single_template_hierarchy( $templates ) {
+ // Setup some variables we're going to reference in our custom templates
+ $user_nicename = buddypress()->displayed_user->userdata->user_nicename;
+
+ // Setup our templates based on priority
+ $new_templates = apply_filters( 'bp_template_hierarchy_members_single_item', array(
+ 'members/single/index-id-' . sanitize_file_name( bp_displayed_user_id() ) . '.php',
+ 'members/single/index-nicename-' . sanitize_file_name( $user_nicename ) . '.php',
+ 'members/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php',
+ 'members/single/index-component-' . sanitize_file_name( bp_current_component() ) . '.php',
+ 'members/single/index.php'
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with the displayed user's data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span><span class="lines">@@ -413,6 +468,7 @@
</span><span class="cx"> bp_update_is_directory( false, 'register' );
</span><span class="cx">
</span><span class="cx"> // Setup actions
</span><ins>+ add_filter( 'bp_get_buddypress_template', array( $this, 'template_hierarchy' ) );
</ins><span class="cx"> add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'dummy_post' ) );
</span><span class="cx"> add_filter( 'bp_replace_the_content', array( $this, 'dummy_content' ) );
</span><span class="cx"> }
</span><span class="lines">@@ -420,6 +476,31 @@
</span><span class="cx"> /** Template ***********************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Add template hierarchy to theme compat for registration / activation pages.
+ *
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
+ *
+ * @since BuddyPress (1.8)
+ *
+ * @param string $templates The templates from bp_get_theme_compat_templates()
+ * @return array $templates Array of custom templates to look for.
+ */
+ public function template_hierarchy( $templates ) {
+ $component = sanitize_file_name( bp_current_component() );
+
+ // Setup our templates based on priority
+ $new_templates = apply_filters( "bp_template_hierarchy_{$component}", array(
+ "members/index-{$component}.php"
+ ) );
+
+ // Merge new templates with existing stack
+ // @see bp_get_theme_compat_templates()
+ $templates = array_merge( (array) $new_templates, $templates );
+
+ return $templates;
+ }
+
+ /**
</ins><span class="cx"> * Update the global $post with dummy data
</span><span class="cx"> *
</span><span class="cx"> * @since BuddyPress (1.7)
</span></span></pre>
</div>
</div>
</body>
</html>