<!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] [1714] trunk: Signup avatar upload fixes and DB fixes.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1714</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-08-27 17:43:08 +0000 (Thu, 27 Aug 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Signup avatar upload fixes and DB fixes.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreavatarsphp">trunk/bp-core/bp-core-avatars.php</a></li>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.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>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoreavatarsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-avatars.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-avatars.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-core/bp-core-avatars.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx">         add_filter( 'upload_dir', $upload_dir_filter, 10, 0 );
</span><span class="cx">         
</span><span class="cx">         $bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) );
</span><del>-        
</del><ins>+
</ins><span class="cx">         // Move the file to the correct upload location.
</span><span class="cx">         if ( !empty( $bp->avatar_admin->original['error'] ) ) {
</span><span class="cx">                 bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $bp->avatar_admin->original['error'] ), 'error' );
</span></span></pre></div>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-core/bp-core-catchuri.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -100,12 +100,12 @@
</span><span class="cx">         /* Reset the keys by merging with an empty array */
</span><span class="cx">         $bp_uri = array_merge( array(), $bp_uri );
</span><span class="cx">         $bp_unfiltered_uri = $bp_uri;
</span><del>-        
</del><ins>+
</ins><span class="cx">         /* Catch a member page and set the current member ID */
</span><span class="cx">         if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'wp-load.php', $bp_uri ) ) {
</span><span class="cx">                 $is_member_page = true;
</span><span class="cx">                 $is_root_component = true;
</span><del>-                
</del><ins>+
</ins><span class="cx">                 // We are within a member page, set up user id globals
</span><span class="cx">                 $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
</span><span class="cx">                                 
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">         $bp_skip_blog_check = $skip_blog_check;
</span><span class="cx">
</span><span class="cx">         $bp_path = $pages;
</span><del>-
</del><ins>+        
</ins><span class="cx">         if ( !bp_is_blog_page() ) {
</span><span class="cx">                 remove_action( 'template_redirect', 'redirect_canonical' );
</span><span class="cx">         }
</span><span class="lines">@@ -244,7 +244,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-add_action( 'wp', 'bp_core_catch_no_access', 10 );
</del><ins>+add_action( 'wp', 'bp_core_catch_no_access' );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * bp_core_catch_profile_uri()
</span></span></pre></div>
<a id="trunkbpcorebpcoresignupphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-signup.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-signup.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-core/bp-core-signup.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -137,12 +137,14 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $bp->avatar_admin->step = 'upload-image';
</span><del>-        
</del><ins>+
</ins><span class="cx">         /* If user has uploaded a new avatar */
</span><span class="cx">         if ( !empty( $_FILES ) ) {
</span><span class="cx">                 
</span><span class="cx">                 /* Check the nonce */
</span><span class="cx">                 check_admin_referer( 'bp_avatar_upload' );
</span><ins>+
+                $bp->signup->step = 'completed-confirmation';
</ins><span class="cx">                 
</span><span class="cx">                 /* Get the activation key */
</span><span class="cx">                 if ( !$bp->signup->key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $_POST[ 'signup_username' ], $_POST[ 'signup_email' ] ) ) ) {
</span><span class="lines">@@ -151,16 +153,13 @@
</span><span class="cx">                         /* Hash the key to create the upload folder (added security so people don't sniff the activation key) */
</span><span class="cx">                         $bp->signup->avatar_dir = wp_hash( $bp->signup->key );
</span><span class="cx">                         
</span><del>-                        /* Pass the file to the avatar upload handler */
-                        $errors = bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' );
-
-                        if ( !$errors ) {
-                                $bp->signup->step = 'completed-confirmation';
</del><ins>+                        /* Pass the file to the avatar upload handler */                
+                        if ( bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' ) ) {                
</ins><span class="cx">                                 $bp->avatar_admin->step = 'crop-image';
</span><span class="cx">
</span><span class="cx">                                 /* Make sure we include the jQuery jCrop file for image cropping */
</span><span class="cx">                                 add_action( 'wp', 'bp_core_add_jquery_cropper' );
</span><del>-                        }
</del><ins>+                        }                        
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -190,7 +189,7 @@
</span><span class="cx">         if ( !$bp->signup->avatar_dir )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><del>-        $path = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
</del><ins>+        $path = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
</ins><span class="cx">         $newdir = path_join( ABSPATH, $path );
</span><span class="cx">         $newdir .= '/avatars/signups/' . $bp->signup->avatar_dir;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-core/bp-core-templatetags.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -827,17 +827,17 @@
</span><span class="cx">                 
</span><span class="cx">                 $signup_avatar_dir = ( !empty( $_POST['signup_avatar_dir'] ) ) ? $_POST['signup_avatar_dir'] : $bp->signup->avatar_dir;
</span><span class="cx">
</span><del>-                if ( empty( $signup_avatar_dir) ) {
-                        if ( empty( $bp->grav_default ) ) {
</del><ins>+                if ( empty( $signup_avatar_dir ) ) {
+                        if ( empty( $bp->grav_default->user ) ) {
</ins><span class="cx">                                 $default_grav = 'wavatar';
</span><del>-                        } else if ( 'mystery' == $bp->grav_default ) {
</del><ins>+                        } else if ( 'mystery' == $bp->grav_default->user ) {
</ins><span class="cx">                                 $default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
</span><span class="cx">                         } else {
</span><del>-                                $default_grav = $bp->grav_default;
</del><ins>+                                $default_grav = $bp->grav_default->user;
</ins><span class="cx">                         }
</span><span class="cx">                 
</span><span class="cx">                         $gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
</span><del>-                        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 . '" />';
</del><ins>+                        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><span class="cx">                         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 ) ) );
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-groups.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-define ( 'BP_GROUPS_DB_VERSION', '1710' );
</del><ins>+define ( 'BP_GROUPS_DB_VERSION', '1711' );
</ins><span class="cx">
</span><span class="cx"> /* Define the slug for the component */
</span><span class="cx"> if ( !defined( 'BP_GROUPS_SLUG' ) )
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">                         status varchar(10) NOT NULL DEFAULT 'public',
</span><span class="cx">                         enable_wire tinyint(1) NOT NULL DEFAULT '1',
</span><span class="cx">                         enable_forum tinyint(1) NOT NULL DEFAULT '1',
</span><del>-                        date_created datetime NOT NULL
</del><ins>+                        date_created datetime NOT NULL,
</ins><span class="cx">                  KEY creator_id (creator_id),
</span><span class="cx">                  KEY status (status)
</span><span class="cx">                   ) {$charset_collate};";
</span><span class="lines">@@ -532,7 +532,6 @@
</span><span class="cx">                                 /* Make sure we include the jQuery jCrop file for image cropping */
</span><span class="cx">                                 add_action( 'wp', 'bp_core_add_jquery_cropper' );
</span><span class="cx">                         }
</span><del>-                        //var_dump($_COOKIE);
</del><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 /* If the image cropping is done, crop the image and save a full/thumb version */
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1713 => 1714)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-08-27 14:11:07 UTC (rev 1713)
+++ trunk/bp-xprofile.php        2009-08-27 17:43:08 UTC (rev 1714)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> <?php
</span><del>-define ( 'BP_XPROFILE_DB_VERSION', '1700' );
</del><ins>+define ( 'BP_XPROFILE_DB_VERSION', '1705' );
</ins><span class="cx">
</span><span class="cx"> /* Define the slug for the component */
</span><span class="cx"> if ( !defined( 'BP_XPROFILE_SLUG' ) )
</span><span class="lines">@@ -83,9 +83,9 @@
</span><span class="cx">                 $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";
</span><span class="cx">         
</span><span class="cx">                 $sql[] = "INSERT INTO {$bp->profile->table_name_fields} (
</span><del>-                                        id, group_id, parent_id, type, name, description, is_required, field_order, option_order, order_by, is_public, can_delete
</del><ins>+                                        id, group_id, parent_id, type, name, is_required, can_delete
</ins><span class="cx">                                  ) VALUES (
</span><del>-                                        1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', '', 1, 1, 0, '', 1, 0
</del><ins>+                                        1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', 1, 0
</ins><span class="cx">                                  );";
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -105,12 +105,11 @@
</span><span class="cx">                 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
</span><span class="cx">
</span><span class="cx">         $sql[] = "CREATE TABLE {$bp->profile->table_name_wire} (
</span><del>-                          id bigint(20) NOT NULL AUTO_INCREMENT,
</del><ins>+                          id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</ins><span class="cx">                          item_id bigint(20) NOT NULL,
</span><span class="cx">                          user_id bigint(20) NOT NULL,
</span><span class="cx">                          content longtext NOT NULL,
</span><span class="cx">                          date_posted datetime NOT NULL,
</span><del>-                         PRIMARY KEY id (id),
</del><span class="cx">                          KEY item_id (item_id),
</span><span class="cx">                  KEY user_id (user_id)
</span><span class="cx">                   ) {$charset_collate};";
</span><span class="lines">@@ -371,7 +370,7 @@
</span><span class="cx">                 check_admin_referer( 'bp_avatar_cropstore' );
</span><span class="cx">
</span><span class="cx">                 if ( !bp_core_avatar_handle_crop( array( 'item_id' => $bp->displayed_user->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
</span><del>-                        bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ) );
</del><ins>+                        bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
</ins><span class="cx">                 else
</span><span class="cx">                         bp_core_add_message( __( 'Your new avatar was uploaded successfully!', 'buddypress' ) );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>