<!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] [2335] trunk/bp-core.php:
  Fixes #1594 - member profile link error.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2335</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-18 13:57:03 +0000 (Mon, 18 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #1594 - member profile link error. Props grimbog.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2334 => 2335)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2010-01-18 12:17:20 UTC (rev 2334)
+++ trunk/bp-core.php        2010-01-18 13:57:03 UTC (rev 2335)
</span><span class="lines">@@ -546,7 +546,8 @@
</span><span class="cx">                         $domain = $bp-&gt;root_domain . '/' . $username . '/';
</span><span class="cx"> 
</span><span class="cx">                 /* Cache the link */
</span><del>-                wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' );
</del><ins>+                if ( !empty( $domain ) )
+                        wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return apply_filters( 'bp_core_get_user_domain', $domain );
</span><span class="lines">@@ -986,26 +987,26 @@
</span><span class="cx">  * @return false on no match
</span><span class="cx">  * @return str the username of the matched user.
</span><span class="cx">  */
</span><del>-function bp_core_get_username( $uid, $user_nicename = false, $user_login = false ) {
</del><ins>+function bp_core_get_username( $user_id, $user_nicename = false, $user_login = false ) {
</ins><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( !$username = wp_cache_get( 'bp_user_username_' . $uid, 'bp' ) ) {
</del><ins>+        if ( !$username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ) ) {
</ins><span class="cx">                 if ( empty( $user_nicename ) &amp;&amp; empty( $user_login ) ) {
</span><span class="cx">                         $ud = false;
</span><span class="cx"> 
</span><del>-                        if ( $bp-&gt;loggedin_user-&gt;id == $uid )
</del><ins>+                        if ( $bp-&gt;loggedin_user-&gt;id == $user_id )
</ins><span class="cx">                                 $ud = &amp;$bp-&gt;loggedin_user-&gt;userdata;
</span><span class="cx"> 
</span><del>-                        if ( $bp-&gt;displayed_user-&gt;id == $uid )
</del><ins>+                        if ( $bp-&gt;displayed_user-&gt;id == $user_id )
</ins><span class="cx">                                 $ud = &amp;$bp-&gt;displayed_user-&gt;userdata;
</span><span class="cx"> 
</span><span class="cx">                         if ( empty( $ud ) ) {
</span><del>-                                if ( !$ud = bp_core_get_core_userdata($uid) )
</del><ins>+                                if ( !$ud = bp_core_get_core_userdata( $user_id ) )
</ins><span class="cx">                                         return false;
</span><ins>+                        }
</ins><span class="cx"> 
</span><del>-                                $user_nicename = $ud-&gt;user_nicename;
-                                $user_login = $ud-&gt;user_login;
-                        }
</del><ins>+                        $user_nicename = $ud-&gt;user_nicename;
+                        $user_login = $ud-&gt;user_login;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
</span><span class="lines">@@ -1015,7 +1016,8 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* Add this to cache */
</span><del>-        wp_cache_set( 'bp_user_username_' . $uid, 'bp' );
</del><ins>+        if ( !empty( $username ) )
+                wp_cache_set( 'bp_user_username_' . $user_id, $username, 'bp' );
</ins><span class="cx"> 
</span><span class="cx">         return apply_filters( 'bp_core_get_username', $username );
</span><span class="cx"> }
</span><span class="lines">@@ -1033,7 +1035,7 @@
</span><span class="cx">  */
</span><span class="cx"> function bp_core_get_user_email( $uid ) {
</span><span class="cx">         if ( !$email = wp_cache_get( 'bp_user_email_' . $uid, 'bp' ) ) {
</span><del>-                $ud = get_userdata($uid);
</del><ins>+                $ud = bp_core_get_core_userdata($uid);
</ins><span class="cx">                 $email = $ud-&gt;user_email;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1065,7 +1067,6 @@
</span><span class="cx">  * @return str The link text based on passed parameters.
</span><span class="cx">  */
</span><span class="cx"> function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false, $deprecated = false, $with_s = false ) {
</span><del>-
</del><span class="cx">         $display_name = bp_core_get_user_displayname( $user_id );
</span><span class="cx"> 
</span><span class="cx">         if ( $with_s )
</span><span class="lines">@@ -1109,7 +1110,7 @@
</span><span class="cx">                         $fullname = xprofile_get_field_data( 1, $user_id );
</span><span class="cx"> 
</span><span class="cx">                         if ( empty($fullname) ) {
</span><del>-                                $ud = get_userdata( $user_id );
</del><ins>+                                $ud = bp_core_get_core_userdata( $user_id );
</ins><span class="cx"> 
</span><span class="cx">                                 if ( !empty( $ud-&gt;display_name ) )
</span><span class="cx">                                         $fullname = $ud-&gt;display_name;
</span><span class="lines">@@ -1119,7 +1120,7 @@
</span><span class="cx">                                 xprofile_set_field_data( 1, $user_id, $fullname );
</span><span class="cx">                         }
</span><span class="cx">                 } else {
</span><del>-                        $ud = get_userdata($user_id);
</del><ins>+                        $ud = bp_core_get_core_userdata($user_id);
</ins><span class="cx"> 
</span><span class="cx">                         if ( !empty( $ud-&gt;display_name ) )
</span><span class="cx">                                 $fullname = $ud-&gt;display_name;
</span><span class="lines">@@ -1127,7 +1128,8 @@
</span><span class="cx">                                 $fullname = $ud-&gt;user_nicename;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
</del><ins>+                if ( !empty( $fullname ) )
+                        wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return apply_filters( 'bp_core_get_user_displayname', $fullname );
</span></span></pre>
</div>
</div>

</body>
</html>