<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [1739] trunk:
  Enabled support for users to appear in the root by defining '
 BP_ENABLE_ROOT_PROFILES' as true in your wp-config.php file.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1739</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-08-31 17:51:29 +0000 (Mon, 31 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Enabled support for users to appear in the root by defining 'BP_ENABLE_ROOT_PROFILES' as true in your wp-config.php file.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (1738 => 1739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php        2009-08-31 14:11:08 UTC (rev 1738)
+++ trunk/bp-core/bp-core-catchuri.php        2009-08-31 17:51:29 UTC (rev 1739)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> function bp_core_set_uri_globals() {
</span><span class="cx">         global $current_component, $current_action, $action_variables;
</span><span class="cx">         global $displayed_user_id;
</span><del>-        global $is_member_page, $is_new_friend;
</del><ins>+        global $is_member_page;
</ins><span class="cx">         global $bp_unfiltered_uri;
</span><span class="cx">         global $bp, $current_blog;
</span><span class="cx">         
</span><span class="lines">@@ -98,27 +98,35 @@
</span><span class="cx">         $bp_unfiltered_uri = $bp_uri;
</span><span class="cx"> 
</span><span class="cx">         /* Catch a member page and set the current member ID */
</span><del>-        if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'wp-load.php', $bp_uri ) ) {
-                $is_member_page = true;
-                $is_root_component = true;
</del><ins>+        if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) {
+                if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'wp-load.php', $bp_uri ) ) {
+                        $is_member_page = true;
+                        $is_root_component = true;
</ins><span class="cx"> 
</span><del>-                // We are within a member page, set up user id globals
-                $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
</del><ins>+                        // We are within a member page, set up user id globals
+                        $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
</ins><span class="cx">                                 
</span><del>-                unset($bp_uri[0]);
-                unset($bp_uri[1]);
</del><ins>+                        unset($bp_uri[0]);
+                        unset($bp_uri[1]);
</ins><span class="cx">                 
</span><del>-                // if the get variable 'new' is set this the first visit to a new friends profile.
-                // this means we need to delete friend acceptance notifications, so we set a flag of is_new_friend.
-                if ( isset($_GET['new']) ) {
-                        $is_new_friend = 1;
-                        unset($bp_uri[2]);
</del><ins>+                        /* Reset the keys by merging with an empty array */
+                        $bp_uri = array_merge( array(), $bp_uri );
</ins><span class="cx">                 }
</span><del>-                
-                /* Reset the keys by merging with an empty array */
-                $bp_uri = array_merge( array(), $bp_uri );
</del><ins>+        } else {
+                if ( get_userdatabylogin( $bp_uri[0] ) || in_array( 'wp-load.php', $bp_uri ) ) {
+                        $is_member_page = true;
+                        $is_root_component = true;
+
+                        // We are within a member page, set up user id globals
+                        $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[0] );
+                                
+                        unset($bp_uri[0]);
+
+                        /* Reset the keys by merging with an empty array */
+                        $bp_uri = array_merge( array(), $bp_uri );
+                }
</ins><span class="cx">         }
</span><del>-
</del><ins>+        
</ins><span class="cx">         if ( !isset($is_root_component) )
</span><span class="cx">                 $is_root_component = in_array( $bp_uri[0], $bp-&gt;root_components );
</span><span class="cx"> 
</span><span class="lines">@@ -192,13 +200,13 @@
</span><span class="cx">         global $wp_query;
</span><span class="cx">         
</span><span class="cx">         $page = $bp_path;
</span><del>-
</del><ins>+        
</ins><span class="cx">         /* Don't hijack any URLs on blog pages */
</span><span class="cx">         if ( !$bp_skip_blog_check ) {
</span><span class="cx">                 if ( bp_is_blog_page() )
</span><span class="cx">                         return false;
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         /* Make sure this is not reported as a 404 */
</span><span class="cx">         if ( !$bp_no_status_set ) {
</span><span class="cx">                 status_header( 200 );
</span><span class="lines">@@ -208,6 +216,7 @@
</span><span class="cx">                         $wp_query-&gt;is_page = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">         if ( $located_template = locate_template( array( $page . '.php' ) ) ) {
</span><span class="cx">                 load_template( apply_filters( 'bp_load_template', $located_template ) );
</span><span class="cx">         } else {
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (1738 => 1739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-08-31 14:11:08 UTC (rev 1738)
+++ trunk/bp-core/bp-core-templatetags.php        2009-08-31 17:51:29 UTC (rev 1739)
</span><span class="lines">@@ -460,7 +460,7 @@
</span><span class="cx"> 
</span><span class="cx"> function bp_is_blog_page() {
</span><span class="cx">         global $bp, $is_member_page;
</span><del>-        
</del><ins>+
</ins><span class="cx">         if ( $bp-&gt;current_component == BP_HOME_BLOG_SLUG )
</span><span class="cx">                 return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1738 => 1739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-08-31 14:11:08 UTC (rev 1738)
+++ trunk/bp-core.php        2009-08-31 17:51:29 UTC (rev 1739)
</span><span class="lines">@@ -350,10 +350,12 @@
</span><span class="cx"> function bp_core_action_directory_members() {
</span><span class="cx">         global $bp;
</span><span class="cx">         
</span><del>-        if ( !is_home() &amp;&amp; is_null( $bp-&gt;displayed_user-&gt;id ) &amp;&amp; $bp-&gt;current_component == $bp-&gt;default_component ) {
</del><ins>+        if ( !is_home() &amp;&amp; is_null( $bp-&gt;displayed_user-&gt;id ) &amp;&amp; $bp-&gt;current_component == BP_MEMBERS_SLUG ) {
</ins><span class="cx">                 $bp-&gt;is_directory = true;
</span><del>-                $bp-&gt;current_component = false;
-
</del><ins>+                
+                if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )
+                        $bp-&gt;current_component = false;
+                
</ins><span class="cx">                 do_action( 'bp_core_action_directory_members' );
</span><span class="cx">                 bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'directories/members/index' ) );
</span><span class="cx">         }
</span><span class="lines">@@ -378,7 +380,11 @@
</span><span class="cx">         
</span><span class="cx">         $ud = get_userdata($user_id);
</span><span class="cx">         
</span><del>-        return apply_filters( 'bp_core_get_user_domain', $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/' );
</del><ins>+        /* If we are using a members slug, include it. */
+        if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )
+                return apply_filters( 'bp_core_get_user_domain', $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/' );
+        else
+                return apply_filters( 'bp_core_get_user_domain', $bp-&gt;root_domain . '/' . $ud-&gt;user_login . '/' );                
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -715,7 +721,11 @@
</span><span class="cx">                 $user = BP_Core_User::get_random_users(1);
</span><span class="cx">                 
</span><span class="cx">                 $ud = get_userdata( $user['users'][0]-&gt;user_id );
</span><del>-                bp_core_redirect( $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login );
</del><ins>+                
+                if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )
+                        bp_core_redirect( $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login );
+                else
+                        bp_core_redirect( $bp-&gt;root_domain . '/' . $ud-&gt;user_login );                        
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp', 'bp_core_get_random_member' );
</span><span class="lines">@@ -783,8 +793,11 @@
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><span class="cx">         $ud = get_userdata($uid);
</span><del>-                
-        return apply_filters( 'bp_core_get_userurl', $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/' );
</del><ins>+        
+        if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) )        
+                return apply_filters( 'bp_core_get_userurl', $bp-&gt;root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud-&gt;user_login . '/' );
+        else
+                return apply_filters( 'bp_core_get_userurl', $bp-&gt;root_domain . '/' . $ud-&gt;user_login . '/' );        
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1738 => 1739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-08-31 14:11:08 UTC (rev 1738)
+++ trunk/bp-xprofile.php        2009-08-31 17:51:29 UTC (rev 1739)
</span><span class="lines">@@ -243,14 +243,14 @@
</span><span class="cx">  * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
</span><span class="cx">  */
</span><span class="cx"> function xprofile_screen_display_profile() {
</span><del>-        global $bp, $is_new_friend;
</del><ins>+        global $bp;
</ins><span class="cx"> 
</span><span class="cx">         // If this is a first visit to a new friends profile, delete the friend accepted notifications for the
</span><del>-        // logged in user. $is_new_friend is set in bp-core/bp-core-catchuri.php in bp_core_set_uri_globals()
-        if ( $is_new_friend )
</del><ins>+        // logged in user, only if $_GET['new'] is set.
+        if ( isset($_GET['new']) )
</ins><span class="cx">                 bp_core_delete_notifications_for_user_by_item_id( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;displayed_user-&gt;id, 'friends', 'friendship_accepted' );
</span><span class="cx">         
</span><del>-        do_action( 'xprofile_screen_display_profile', $is_new_friend );
</del><ins>+        do_action( 'xprofile_screen_display_profile', $_GET['new'] );
</ins><span class="cx">         bp_core_load_template( apply_filters( 'xprofile_template_display_profile', 'profile/index' ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>