<!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] [2609] trunk/bp-core: Fixes #1817</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2609</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-05 15:09:16 +0000 (Fri, 05 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixes #1817</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreactivationphp">trunk/bp-core/bp-core-activation.php</a></li>
<li><a href="#trunkbpcorebpcoresignupphp">trunk/bp-core/bp-core-signup.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoreactivationphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-activation.php (2608 => 2609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-activation.php        2010-02-05 14:11:08 UTC (rev 2608)
+++ trunk/bp-core/bp-core-activation.php        2010-02-05 15:09:16 UTC (rev 2609)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx">                 $hashed_key = wp_hash( $_GET['key'] );
</span><span class="cx">
</span><span class="cx">                 /* Check if the avatar folder exists. If it does, move rename it, move it and delete the signup avatar dir */
</span><del>-                if ( file_exists( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key ) ) {
-                        @rename( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key, WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/' . $signup['user_id'] );
</del><ins>+                if ( file_exists( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $hashed_key ) ) {
+                        @rename( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $hashed_key, BP_AVATAR_UPLOAD_PATH . '/avatars/' . $signup['user_id'] );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 /* Record the new user in the activity streams */
</span></span></pre></div>
<a id="trunkbpcorebpcoresignupphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-signup.php (2608 => 2609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-signup.php        2010-02-05 14:11:08 UTC (rev 2608)
+++ trunk/bp-core/bp-core-signup.php        2010-02-05 15:09:16 UTC (rev 2609)
</span><span class="lines">@@ -185,6 +185,14 @@
</span><span class="cx">                 else
</span><span class="cx">                         bp_core_add_message( __( 'Your new avatar was uploaded successfully', 'buddypress' ) );
</span><span class="cx">
</span><ins>+                /* If this is a single WP install, move the avatar to the user's folder since there is no activation process to move it. */
+                if ( !bp_core_is_multisite() ) {
+                        $user_id = bp_core_get_userid( $_POST['signup_username'] );
+
+                        if ( !empty( $user_id ) && file_exists( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $_POST['signup_avatar_dir'] ) ) {
+                                @rename( BP_AVATAR_UPLOAD_PATH . '/avatars/signups/' . $_POST['signup_avatar_dir'], BP_AVATAR_UPLOAD_PATH . '/avatars/' . $user_id );
+                        }
+                }
</ins><span class="cx">         }
</span><span class="cx">         bp_core_load_template( 'registration/register' );
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (2608 => 2609)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-02-05 14:11:08 UTC (rev 2608)
+++ trunk/bp-core/bp-core-templatetags.php        2010-02-05 15:09:16 UTC (rev 2609)
</span><span class="lines">@@ -1225,21 +1225,26 @@
</span><span class="cx">                 $r = wp_parse_args( $args, $defaults );
</span><span class="cx">                 extract( $r, EXTR_SKIP );
</span><span class="cx">
</span><del>-                $signup_avatar_dir = ( !empty( $_POST['signup_avatar_dir'] ) ) ? $_POST['signup_avatar_dir'] : $bp->signup->avatar_dir;
</del><ins>+                if ( !bp_core_is_multisite() && !empty( $_POST['signup_username'] ) ) {
+                        $user_id = bp_core_get_userid( $_POST['signup_username'] );
+                        return apply_filters( 'bp_get_signup_avatar', bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) ) );
+                } else {
+                        $signup_avatar_dir = ( !empty( $_POST['signup_avatar_dir'] ) ) ? $_POST['signup_avatar_dir'] : $bp->signup->avatar_dir;
</ins><span class="cx">
</span><del>-                if ( empty( $signup_avatar_dir ) ) {
-                        if ( empty( $bp->grav_default->user ) ) {
-                                $default_grav = 'wavatar';
-                        } else if ( 'mystery' == $bp->grav_default->user ) {
-                                $default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
</del><ins>+                        if ( empty( $signup_avatar_dir ) ) {
+                                if ( empty( $bp->grav_default->user ) ) {
+                                        $default_grav = 'wavatar';
+                                } else if ( 'mystery' == $bp->grav_default->user ) {
+                                        $default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
+                                } else {
+                                        $default_grav = $bp->grav_default->user;
+                                }
+
+                                $gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
+                                return apply_filters( 'bp_get_signup_avatar', '<img src="' . $gravatar_url . md5( $_POST['signup_email'] ) . '?d=' . $default_grav . '&amp;s=' . $size ) . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
</ins><span class="cx">                         } else {
</span><del>-                                $default_grav = $bp->grav_default->user;
</del><ins>+                                return apply_filters( 'bp_get_signup_avatar', bp_core_fetch_avatar( array( 'item_id' => $signup_avatar_dir, 'object' => 'signup', 'avatar_dir' => 'avatars/signups', 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) ) );
</ins><span class="cx">                         }
</span><del>-
-                        $gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
-                        return apply_filters( 'bp_get_signup_avatar', '<img src="' . $gravatar_url . md5( $_POST['signup_email'] ) . '?d=' . $default_grav . '&amp;s=' . $size ) . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
-                } else {
-                        return apply_filters( 'bp_get_signup_avatar', bp_core_fetch_avatar( array( 'item_id' => $signup_avatar_dir, 'object' => 'signup', 'avatar_dir' => 'avatars/signups', 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) ) );
</del><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>