Changeset 3691 for trunk/bp-core/bp-core-signup.php
- Timestamp:
- 01/09/2011 10:07:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-signup.php
r3666 r3691 156 156 } 157 157 158 $bp->avatar_admin->step = 'upload-image'; 159 160 /* If user has uploaded a new avatar */ 161 if ( !empty( $_FILES ) ) { 162 163 /* Check the nonce */ 164 check_admin_referer( 'bp_avatar_upload' ); 165 166 $bp->signup->step = 'completed-confirmation'; 167 168 if ( is_multisite() ) { 169 /* Get the activation key */ 170 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' ] ) ) ) { 171 bp_core_add_message( __( 'There was a problem uploading your avatar, please try uploading it again', 'buddypress' ) ); 172 } else { 173 /* Hash the key to create the upload folder (added security so people don't sniff the activation key) */ 174 $bp->signup->avatar_dir = wp_hash( $bp->signup->key ); 175 } 176 } else { 177 $user_id = bp_core_get_userid( $_POST['signup_username'] ); 178 $bp->signup->avatar_dir = wp_hash( $user_id ); 179 } 180 181 /* Pass the file to the avatar upload handler */ 182 if ( bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' ) ) { 183 $bp->avatar_admin->step = 'crop-image'; 184 185 /* Make sure we include the jQuery jCrop file for image cropping */ 186 add_action( 'wp_print_scripts', 'bp_core_add_jquery_cropper' ); 187 } 188 } 189 190 /* If the image cropping is done, crop the image and save a full/thumb version */ 191 if ( isset( $_POST['avatar-crop-submit'] ) ) { 192 193 /* Check the nonce */ 194 check_admin_referer( 'bp_avatar_cropstore' ); 195 196 /* Reset the avatar step so we can show the upload form again if needed */ 197 $bp->signup->step = 'completed-confirmation'; 198 $bp->avatar_admin->step = 'upload-image'; 199 200 if ( !bp_core_avatar_handle_crop( array( 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) ) 201 bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' ); 202 else 203 bp_core_add_message( __( 'Your new avatar was uploaded successfully', 'buddypress' ) ); 204 } 158 do_action( 'bp_core_screen_signup' ); 205 159 bp_core_load_template( apply_filters( 'bp_core_template_register', 'registration/register' ) ); 206 160 }
Note: See TracChangeset
for help on using the changeset viewer.