<!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][10774] trunk/src: Introduce the support for a custom home page template for single members profiles.</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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/10774">10774</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/10774","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-05-17 15:30:29 +0000 (Tue, 17 May 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Introduce the support for a custom home page template for single members profiles.

- Themes can now include a `front.php` template to customize the home page of members.
- Introduce a template hierarchy for this template so that it is possible to have different front pages according to the ID, the nicename or the member type of the displayed user.

Props hnla, dcavins, DJPaul, imath.

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/6769">#6769</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcorebpcoretemplatephp">trunk/src/bp-core/bp-core-template.php</a></li>
<li><a href="#trunksrcbpmembersbpmembersfunctionsphp">trunk/src/bp-members/bp-members-functions.php</a></li>
<li><a href="#trunksrcbpmembersbpmemberstemplatephp">trunk/src/bp-members/bp-members-template.php</a></li>
<li><a href="#trunksrcbpmembersclassesclassbpmemberscomponentphp">trunk/src/bp-members/classes/class-bp-members-component.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssinglehomephp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/home.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcorebpcoretemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-template.php    2016-05-15 04:01:30 UTC (rev 10773)
+++ trunk/src/bp-core/bp-core-template.php      2016-05-17 15:30:29 UTC (rev 10774)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2271,6 +2271,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Is the current page a user custom front page?
+ *
+ * Will return true anytime there is a custom front page for the displayed user.
+ *
+ * @since 2.6.0
+ *
+ * @return bool True if the current page is a user custom front page.
+ */
+function bp_is_user_front() {
+       return (bool) ( bp_is_user() && bp_is_current_component( 'front' ) );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Is the current page a user's activity stream page?
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Eg http://example.com/members/joe/activity/ (or any subpages thereof).
</span></span></pre></div>
<a id="trunksrcbpmembersbpmembersfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-functions.php     2016-05-15 04:01:30 UTC (rev 10773)
+++ trunk/src/bp-members/bp-members-functions.php       2016-05-17 15:30:29 UTC (rev 10774)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2480,6 +2480,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'login_form_bp-spam', 'bp_live_spammer_login_error' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Get the displayed user Object
+ *
+ * @since 2.6.0
+ *
+ * @return object The displayed user object, null otherwise.
+ */
+function bp_get_displayed_user() {
+       $bp = buddypress();
+
+       $displayed_user = null;
+       if ( ! empty( $bp->displayed_user->id ) ) {
+               $displayed_user = $bp->displayed_user;
+       }
+
+       /**
+        * Filters the displayed_user object corresponding to the displayed member.
+        *
+        * @since 2.6.0
+        *
+        * @param object $displayed_user The displayed_user object.
+        */
+       return apply_filters( 'bp_get_displayed_user', $displayed_user );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** Member Types *************************************************************/
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcbpmembersbpmemberstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-template.php      2016-05-15 04:01:30 UTC (rev 10773)
+++ trunk/src/bp-members/bp-members-template.php        2016-05-17 15:30:29 UTC (rev 10774)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1326,6 +1326,98 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Output the contents of the current user's home page.
+ *
+ * @since 2.6.0
+ */
+function bp_displayed_user_front_template_part() {
+       $located = bp_displayed_user_get_front_template();
+
+       if ( false !== $located ) {
+               $slug = str_replace( '.php', '', $located );
+               $name = null;
+
+               /**
+                * Let plugins adding an action to bp_get_template_part get it from here
+                *
+                * @param string $slug Template part slug requested.
+                * @param string $name Template part name requested.
+                */
+               do_action( 'get_template_part_' . $slug, $slug, $name );
+
+               load_template( $located, true );
+       }
+
+       return $located;
+}
+
+/**
+ * Locate a custom user front template if it exists.
+ *
+ * @since 2.6.0
+ *
+ * @param  object|null $displayed_user Optional. Falls back to current user if not passed.
+ * @return string|bool                 Path to front template on success; boolean false on failure.
+ */
+function bp_displayed_user_get_front_template( $displayed_user = null ) {
+       if ( ! is_object( $displayed_user ) || empty( $displayed_user->id ) ) {
+               $displayed_user = bp_get_displayed_user();
+       }
+
+       if ( ! isset( $displayed_user->id ) ) {
+               return false;
+       }
+
+       if ( isset( $displayed_user->front_template ) ) {
+               return $displayed_user->front_template;
+       }
+
+       // Init the hierarchy
+       $template_names = array(
+               'members/single/front-id-' . sanitize_file_name( $displayed_user->id ) . '.php',
+               'members/single/front-nicename-' . sanitize_file_name( $displayed_user->userdata->user_nicename ) . '.php',
+       );
+
+       /**
+        * Check for member types and add it to the hierarchy
+        *
+        * Make sure to register your member
+        * type using the hook 'bp_register_member_types'
+        */
+       if ( bp_get_member_types() ) {
+               $displayed_user_member_type = bp_get_member_type( $displayed_user->id );
+               if ( ! $displayed_user_member_type ) {
+                       $displayed_user_member_type = 'none';
+               }
+
+               $template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type )   . '.php';
+       }
+
+       // Add The generic template to the end of the hierarchy
+       $template_names[] = 'members/single/front.php';
+
+       /**
+        * Filters the hierarchy of user front templates corresponding to a specific user.
+        *
+        * @since 2.6.0
+        *
+        * @param array  $template_names Array of template paths.
+        */
+       return bp_locate_template( apply_filters( 'bp_displayed_user_get_front_template', $template_names ), false, true );
+}
+
+/**
+ * Check if the displayed user has a custom front template.
+ *
+ * @since 2.6.0
+ */
+function bp_displayed_user_has_front_template() {
+       $displayed_user = bp_get_displayed_user();
+
+       return ! empty( $displayed_user->front_template );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Render the navigation markup for the displayed user.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 1.1.0
</span></span></pre></div>
<a id="trunksrcbpmembersclassesclassbpmemberscomponentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/classes/class-bp-members-component.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/classes/class-bp-members-component.php       2016-05-15 04:01:30 UTC (rev 10773)
+++ trunk/src/bp-members/classes/class-bp-members-component.php 2016-05-17 15:30:29 UTC (rev 10774)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,6 +153,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Initialize the nav for the members component.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->nav = new BP_Core_Nav();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // If A user is displayed, check if there is a front template
+               if ( bp_get_displayed_user() ) {
+                       $bp->displayed_user->front_template = bp_displayed_user_get_front_template();
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /** Signup ***********************************************************
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -178,15 +183,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /** Default Profile Component ****************************************
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               if ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( bp_displayed_user_has_front_template() ) {
+                       $bp->default_component = 'front';
+               } elseif ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $bp->default_component = BP_DEFAULT_COMPONENT;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                } elseif ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
+                       $bp->default_component = bp_get_activity_slug();
</ins><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
-                               $bp->default_component = bp_get_activity_slug();
-                       } else {
-                               $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /** Canonical Component Stack ****************************************
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -242,13 +246,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Bail if XProfile component is active.
-               if ( bp_is_active( 'xprofile' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Don't set up navigation if there's no member.
+               if ( ! is_user_logged_in() && ! bp_is_user() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Don't set up navigation if there's no member.
-               if ( ! is_user_logged_in() && ! bp_is_user() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $is_xprofile_active = bp_is_active( 'xprofile' );
+
+               // Bail if XProfile component is active and there's no custom front page for the user.
+               if ( ! bp_displayed_user_has_front_template() && $is_xprofile_active ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -261,33 +267,103 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $slug         = bp_get_profile_slug();
-               $profile_link = trailingslashit( $user_domain . $slug );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Set slug to profile in case the xProfile component is not active
+               $slug = bp_get_profile_slug();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Setup the main navigation.
-               $main_nav = array(
-                       'name'                => _x( 'Profile', 'Member profile main navigation', 'buddypress' ),
-                       'slug'                => $slug,
-                       'position'            => 20,
-                       'screen_function'     => 'bp_members_screen_display_profile',
-                       'default_subnav_slug' => 'public',
-                       'item_css_id'         => buddypress()->profile->id
-               );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Defaults to empty navs
+               $this->main_nav = array();
+               $this->sub_nav  = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Setup the subnav items for the member profile.
-               $sub_nav[] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! $is_xprofile_active ) {
+                       $this->main_nav = array(
+                               'name'                => _x( 'Profile', 'Member profile main navigation', 'buddypress' ),
+                               'slug'                => $slug,
+                               'position'            => 20,
+                               'screen_function'     => 'bp_members_screen_display_profile',
+                               'default_subnav_slug' => 'public',
+                               'item_css_id'         => buddypress()->profile->id
+                       );
+               }
+
+               /**
+                * Setup the subnav items for the member profile.
+                *
+                * This is required in case there's a custom front or in case the xprofile component
+                * is not active.
+                */
+               $this->sub_nav = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                         'name'            => _x( 'View', 'Member profile view', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'slug'            => 'public',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'parent_url'      => $profile_link,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'parent_url'      => trailingslashit( $user_domain . $slug ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'parent_slug'     => $slug,
</span><span class="cx" style="display: block; padding: 0 10px">                        'screen_function' => 'bp_members_screen_display_profile',
</span><span class="cx" style="display: block; padding: 0 10px">                        'position'        => 10
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                /**
+                * If there's a front template the members component nav
+                * will be there to display the user's front page.
+                */
+               if ( bp_displayed_user_has_front_template() ) {
+                       $main_nav = array(
+                               'name'                => _x( 'Home', 'Member Home page', 'buddypress' ),
+                               'slug'                => 'front',
+                               'position'            => 5,
+                               'screen_function'     => 'bp_members_screen_display_profile',
+                               'default_subnav_slug' => 'public',
+                       );
+
+                       // We need a dummy subnav for the front page to load.
+                       $front_subnav = $this->sub_nav;
+                       $front_subnav['parent_slug'] = 'front';
+
+                       // In case the subnav is displayed in the front template
+                       $front_subnav['parent_url'] = trailingslashit( $user_domain . 'front' );
+
+                       // Set the subnav
+                       $sub_nav[] = $front_subnav;
+
+                       /**
+                        * If the profile component is not active, we need to create a new
+                        * nav to display the WordPress profile.
+                        */
+                       if ( ! $is_xprofile_active ) {
+                               add_action( 'bp_members_setup_nav', array( $this, 'setup_profile_nav' ) );
+                       }
+
+               /**
+                * If there's no front template and xProfile is not active, the members
+                * component nav will be there to display the WordPress profile
+                */
+               } else {
+                       $main_nav  = $this->main_nav;
+                       $sub_nav[] = $this->sub_nav;
+               }
+
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 parent::setup_nav( $main_nav, $sub_nav );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Set up a profile nav in case the xProfile
+        * component is not active and a front template is
+        * used.
+        *
+        * @since 2.6.0
+        */
+       public function setup_profile_nav() {
+               if ( empty( $this->main_nav ) || empty( $this->sub_nav ) ) {
+                       return;
+               }
+
+               // Add the main nav
+               bp_core_new_nav_item( $this->main_nav, 'members' );
+
+               // Add the sub nav item.
+               bp_core_new_subnav_item( $this->sub_nav, 'members' );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Set up the title for pages and <title>.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.5.0
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssinglehomephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/home.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/home.php       2016-05-15 04:01:30 UTC (rev 10773)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/home.php 2016-05-17 15:30:29 UTC (rev 10774)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,7 +64,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                do_action( 'bp_before_member_body' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( bp_is_user_activity() || !bp_current_component() ) :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( bp_is_user_front() ) :
+                       bp_displayed_user_front_template_part();
+
+               elseif ( bp_is_user_activity() ) :
</ins><span class="cx" style="display: block; padding: 0 10px">                         bp_get_template_part( 'members/single/activity' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                elseif ( bp_is_user_blogs() ) :
</span></span></pre>
</div>
</div>

</body>
</html>