Skip to:
Content

BuddyPress.org

Changeset 3691


Ignore:
Timestamp:
01/09/2011 10:07:17 PM (16 years ago)
Author:
djpaul
Message:

Remove avatar upload before account activation. Fixes #2741

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-signup.php

    r3666 r3691  
    156156        }
    157157
    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' );
    205159        bp_core_load_template( apply_filters( 'bp_core_template_register', 'registration/register' ) );
    206160}
  • trunk/bp-themes/bp-default/registration/activate.php

    r3306 r3691  
    1 <?php /* This template is only used on multisite installations */ ?>
    2 
    31<?php get_header(); ?>
    42
     
    97
    108                <div class="page" id="activate-page">
    11 
    12                         <?php do_action( 'template_notices' ) ?>
    139
    1410                        <?php if ( bp_account_was_activated() ) : ?>
  • trunk/bp-themes/bp-default/registration/register.php

    r3592 r3691  
    222222
    223223                                <?php do_action( 'template_notices' ) ?>
     224                                <?php do_action( 'bp_before_registration_confirmed' ) ?>
    224225
    225226                                <?php if ( bp_registration_needs_activation() ) : ?>
     
    229230                                <?php endif; ?>
    230231
    231                                 <?php if ( bp_is_active( 'xprofile' ) && !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?>
    232 
    233                                         <?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?>
    234 
    235                                                 <h4><?php _e( 'Your Current Avatar', 'buddypress' ) ?></h4>
    236                                                 <p><?php _e( "We've fetched an avatar for your new account. If you'd like to change this, why not upload a new one?", 'buddypress' ) ?></p>
    237 
    238                                                 <div id="signup-avatar">
    239                                                         <?php bp_signup_avatar() ?>
    240                                                 </div>
    241 
    242                                                 <p>
    243                                                         <input type="file" name="file" id="file" />
    244                                                         <input type="submit" name="upload" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ) ?>" />
    245                                                         <input type="hidden" name="action" id="action" value="bp_avatar_upload" />
    246                                                         <input type="hidden" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
    247                                                         <input type="hidden" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
    248                                                 </p>
    249 
    250                                                 <?php wp_nonce_field( 'bp_avatar_upload' ) ?>
    251 
    252                                         <?php endif; ?>
    253 
    254                                         <?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
    255 
    256                                                 <h3><?php _e( 'Crop Your New Avatar', 'buddypress' ) ?></h3>
    257 
    258                                                 <img src="<?php bp_avatar_to_crop() ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ) ?>" />
    259 
    260                                                 <div id="avatar-crop-pane">
    261                                                         <img src="<?php bp_avatar_to_crop() ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ) ?>" />
    262                                                 </div>
    263 
    264                                                 <input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ) ?>" />
    265 
    266                                                 <input type="hidden" name="signup_email" id="signup_email" value="<?php bp_signup_email_value() ?>" />
    267                                                 <input type="hidden" name="signup_username" id="signup_username" value="<?php bp_signup_username_value() ?>" />
    268                                                 <input type="hidden" name="signup_avatar_dir" id="signup_avatar_dir" value="<?php bp_signup_avatar_dir_value() ?>" />
    269 
    270                                                 <input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src() ?>" />
    271                                                 <input type="hidden" id="x" name="x" />
    272                                                 <input type="hidden" id="y" name="y" />
    273                                                 <input type="hidden" id="w" name="w" />
    274                                                 <input type="hidden" id="h" name="h" />
    275 
    276                                                 <?php wp_nonce_field( 'bp_avatar_cropstore' ) ?>
    277 
    278                                         <?php endif; ?>
    279 
    280                                 <?php endif; ?>
     232                                <?php do_action( 'bp_after_registration_confirmed' ) ?>
    281233
    282234                        <?php endif; // completed-confirmation signup step ?>
Note: See TracChangeset for help on using the changeset viewer.