<!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] [1723] trunk: Fixing bug with inconsistent name display.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1723</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-08-28 19:05:23 +0000 (Fri, 28 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixing bug with inconsistent name display.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsphp">trunk/bp-blogs.php</a></li>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpforumsphp">trunk/bp-forums.php</a></li>
<li><a href="#trunkbpfriendsphp">trunk/bp-friends.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpmessagesphp">trunk/bp-messages.php</a></li>
<li><a href="#trunkbpstatusphp">trunk/bp-status.php</a></li>
<li><a href="#trunkbpwirebpwiretemplatetagsphp">trunk/bp-wire/bp-wire-templatetags.php</a></li>
<li><a href="#trunkbpwirephp">trunk/bp-wire.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileclassesphp">trunk/bp-xprofile/bp-xprofile-classes.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-blogs.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -121,13 +121,13 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;blogs-&gt;slug] = $bp-&gt;blogs-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'bp_blogs_setup_globals', 5 );        
</span><del>-add_action( 'admin_menu', 'bp_blogs_setup_globals', 1 );
</del><ins>+add_action( 'admin_menu', 'bp_blogs_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function bp_blogs_setup_root_component() {
</span><span class="cx">         /* Register 'groups' as a root component */
</span><span class="cx">         bp_core_add_root_component( BP_BLOGS_SLUG );
</span><span class="cx"> }
</span><del>-add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 1 );
</del><ins>+add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 2 );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * bp_blogs_setup_nav()
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_directory_blogs_setup() {
</span><span class="cx">         global $bp;
</span><del>-        
</del><ins>+
</ins><span class="cx">         if ( $bp-&gt;current_component == $bp-&gt;blogs-&gt;slug &amp;&amp; empty( $bp-&gt;current_action ) ) {
</span><span class="cx">                 $bp-&gt;is_directory = true;
</span><span class="cx">                 
</span></span></pre></div>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-core/bp-core-catchuri.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -114,10 +114,9 @@
</span><span class="cx">                         $is_new_friend = 1;
</span><span class="cx">                         unset($bp_uri[2]);
</span><span class="cx">                 }
</span><del>-
</del><ins>+                
</ins><span class="cx">                 /* Reset the keys by merging with an empty array */
</span><span class="cx">                 $bp_uri = array_merge( array(), $bp_uri );
</span><del>-
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( !isset($is_root_component) )
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-core.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -162,8 +162,8 @@
</span><span class="cx">         if ( !$bp-&gt;current_component )
</span><span class="cx">                 $bp-&gt;current_component = $bp-&gt;default_component;
</span><span class="cx"> }
</span><del>-add_action( 'plugins_loaded', 'bp_core_setup_globals', 3 );
-add_action( '_admin_menu', 'bp_core_setup_globals', 3 ); // must be _admin_menu hook.
</del><ins>+add_action( 'plugins_loaded', 'bp_core_setup_globals', 5 );
+add_action( '_admin_menu', 'bp_core_setup_globals', 2 ); // must be _admin_menu hook.
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -878,23 +878,27 @@
</span><span class="cx">                 
</span><span class="cx">         if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
</span><span class="cx">                 if ( function_exists('xprofile_install') ) {
</span><del>-                        $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
</del><ins>+                        $fullname = xprofile_get_field_data( 1, $user_id );
</ins><span class="cx"> 
</span><span class="cx">                         if ( empty($fullname) || !$fullname ) {
</span><span class="cx">                                 $ud = get_userdata($user_id);
</span><span class="cx"> 
</span><del>-                                if ( empty( $ud-&gt;display_name ) )
</del><ins>+                                if ( !empty( $ud-&gt;display_name ) )
+                                        $fullname = $ud-&gt;display_name;
+                                else
</ins><span class="cx">                                         $fullname = $ud-&gt;user_nicename;
</span><del>-                                else
-                                        $fullname = $ud-&gt;display_name;
</del><span class="cx"> 
</span><del>-                                xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $fullname );
</del><ins>+                                xprofile_set_field_data( 1, $user_id, $fullname );
</ins><span class="cx">                         }
</span><span class="cx">                 } else {
</span><span class="cx">                         $ud = get_userdata($user_id);
</span><del>-                        $fullname = $ud-&gt;display_name;
</del><ins>+                        
+                        if ( !empty( $ud-&gt;display_name ) )
+                                $fullname = $ud-&gt;display_name;
+                        else
+                                $fullname = $ud-&gt;user_nicename;
</ins><span class="cx">                 }
</span><del>-
</del><ins>+                
</ins><span class="cx">                 wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
</span><span class="cx">         }
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkbpforumsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-forums.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;forums-&gt;slug] = $bp-&gt;forums-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'bp_forums_setup', 5 );
</span><del>-add_action( 'admin_head', 'bp_forums_setup', 3 );
</del><ins>+add_action( 'admin_head', 'bp_forums_setup', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function bp_forums_is_installed_correctly() {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpfriendsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-friends.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;friends-&gt;slug] = $bp-&gt;friends-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'friends_setup_globals', 5 );        
</span><del>-add_action( 'admin_menu', 'friends_setup_globals', 1 );
</del><ins>+add_action( 'admin_menu', 'friends_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function friends_check_installed() {        
</span><span class="cx">         global $wpdb, $bp;
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-groups.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">         /* Register 'groups' as a root component */
</span><span class="cx">         bp_core_add_root_component( BP_GROUPS_SLUG );
</span><span class="cx"> }
</span><del>-add_action( 'plugins_loaded', 'groups_setup_root_component', 1 );
</del><ins>+add_action( 'plugins_loaded', 'groups_setup_root_component', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function groups_check_installed() {        
</span><span class="cx">         global $wpdb, $bp;
</span></span></pre></div>
<a id="trunkbpmessagesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-messages.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;messages-&gt;slug] = $bp-&gt;messages-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'messages_setup_globals', 5 );        
</span><del>-add_action( 'admin_menu', 'messages_setup_globals', 1 );
</del><ins>+add_action( 'admin_menu', 'messages_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function messages_check_installed() {        
</span><span class="cx">         global $wpdb, $bp;
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">         if ( get_site_option('bp-messages-db-version') &lt; BP_MESSAGES_DB_VERSION )
</span><span class="cx">                 messages_install();
</span><span class="cx"> }
</span><del>-add_action( 'admin_menu', 'messages_check_installed', 1 );
</del><ins>+add_action( 'admin_menu', 'messages_check_installed', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function messages_setup_nav() {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpstatusphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-status.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-status.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-status.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;status-&gt;slug] = $bp-&gt;status-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'bp_status_setup_globals', 5 );        
</span><del>-add_action( 'admin_menu', 'bp_status_setup_globals', 1 );
</del><ins>+add_action( 'admin_menu', 'bp_status_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function bp_status_record_activity( $user_id, $content, $primary_link ) {
</span><span class="cx">         if ( !function_exists( 'bp_activity_add' ) )
</span></span></pre></div>
<a id="trunkbpwirebpwiretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-wire/bp-wire-templatetags.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-wire/bp-wire-templatetags.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-wire/bp-wire-templatetags.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx">         
</span><span class="cx">         function bp_wire_posts_template( $item_id, $component_slug, $can_post, $per_page, $max ) {
</span><span class="cx">                 global $bp;
</span><del>-                
</del><ins>+
</ins><span class="cx">                 if ( $bp-&gt;current_component == $bp-&gt;wire-&gt;slug ) {
</span><span class="cx">                         $this-&gt;table_name = $bp-&gt;profile-&gt;table_name_wire;
</span><span class="cx">                         
</span><span class="lines">@@ -27,9 +27,8 @@
</span><span class="cx">                         if ( 'all-posts' == $bp-&gt;current_action &amp;&amp; bp_is_home() )
</span><span class="cx">                                 bp_core_delete_notifications_for_user_by_type( $bp-&gt;loggedin_user-&gt;id, 'xprofile', 'new_wire_post' );
</span><span class="cx">                         
</span><del>-                } else {
</del><ins>+                } else
</ins><span class="cx">                         $this-&gt;table_name = $bp-&gt;{$bp-&gt;active_components[$component_slug]}-&gt;table_name_wire;
</span><del>-                }
</del><span class="cx">                 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['wpage'] ) ? intval( $_REQUEST['wpage'] ) : 1;
</span><span class="cx">                 $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</span></span></pre></div>
<a id="trunkbpwirephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-wire.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-wire.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-wire.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;wire-&gt;slug] = $bp-&gt;wire-&gt;id;
</span><span class="cx"> }
</span><span class="cx"> add_action( 'plugins_loaded', 'bp_wire_setup_globals', 5 );        
</span><del>-add_action( 'admin_menu', 'bp_wire_setup_globals', 1 );
</del><ins>+add_action( 'admin_menu', 'bp_wire_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> function bp_wire_setup_nav() {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-classes.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-classes.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-xprofile/bp-xprofile-classes.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -696,6 +696,9 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( !$user_id )
</span><span class="cx">                         $user_id = $bp-&gt;displayed_user-&gt;id;
</span><ins>+                        
+                if ( !$bp-&gt;profile )
+                        xprofile_setup_globals();
</ins><span class="cx"> 
</span><span class="cx">                 $sql = $wpdb-&gt;prepare(&quot;SELECT * FROM {$bp-&gt;profile-&gt;table_name_data} WHERE field_id = %d AND user_id = %d&quot;, $field_id, $user_id );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1722 => 1723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-08-28 18:41:13 UTC (rev 1722)
+++ trunk/bp-xprofile.php        2009-08-28 19:05:23 UTC (rev 1723)
</span><span class="lines">@@ -143,14 +143,14 @@
</span><span class="cx"> 
</span><span class="cx">         /* Register this in the active components array */
</span><span class="cx">         $bp-&gt;active_components[$bp-&gt;profile-&gt;slug] = $bp-&gt;profile-&gt;id;
</span><del>-                
</del><ins>+
</ins><span class="cx">         $bp-&gt;profile-&gt;field_types = apply_filters( 'xprofile_field_types', array( 'textbox', 'textarea', 'radio', 'checkbox', 'selectbox', 'multiselectbox', 'datebox' ) );
</span><span class="cx"> 
</span><span class="cx">         if ( function_exists('bp_wire_install') )
</span><span class="cx">                 $bp-&gt;profile-&gt;table_name_wire = $wpdb-&gt;base_prefix . 'bp_xprofile_wire';
</span><span class="cx"> }
</span><del>-add_action( 'plugins_loaded', 'xprofile_setup_globals', 5 );        
-add_action( 'admin_menu', 'xprofile_setup_globals', 1 );
</del><ins>+add_action( 'plugins_loaded', 'xprofile_setup_globals', 5 );
+add_action( 'admin_menu', 'xprofile_setup_globals', 2 );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * xprofile_add_admin_menu()
</span><span class="lines">@@ -811,7 +811,7 @@
</span><span class="cx">                 $field_id = $field;
</span><span class="cx">         else
</span><span class="cx">                 $field_id = xprofile_get_field_id_from_name( $field );
</span><del>-        
</del><ins>+
</ins><span class="cx">         if ( !$field_id )
</span><span class="cx">                 return false;
</span><span class="cx">                 
</span></span></pre>
</div>
</div>

</body>
</html>