Skip to:
Content

BuddyPress.org

Changeset 1530


Ignore:
Timestamp:
06/09/2009 08:57:57 PM (15 years ago)
Author:
apeatling
Message:

Fixes #777

File:
1 edited

Legend:

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

    r1503 r1530  
    11<?php
     2
     3function xprofile_clear_signup_cookie() {
     4    if ( $_POST['stage'] != 'validate-blog-signup' && $_POST['stage'] != 'validate-user-signup' )
     5        setcookie( 'bp_xprofile_meta', false, time()-1000, COOKIEPATH );
     6}
     7add_action( 'init', 'xprofile_clear_signup_cookie' );
    28
    39/**************************************************************************
     
    95101   
    96102    extract($result);
    97    
     103
    98104    if ( $bp_signup_has_errors || $bp_signup_avatar_has_errors )
    99105        $errors->add( 'bp_xprofile_errors', '' );
     
    104110
    105111function xprofile_add_profile_meta( $meta ) {
    106     global $bp, $bp_blog_signup_meta;
     112    global $bp, $bp_blog_signup_meta, $bp_user_signup_meta;
    107113   
    108114    if ( $_POST['stage'] == 'validate-blog-signup' ) {
    109115        $bp_meta = $bp_blog_signup_meta;
    110116    } else if ( $_POST['stage'] == 'validate-user-signup' ) {
    111         $bp_meta = unserialize( stripslashes( $_COOKIE['bp_xprofile_meta'] ) );
     117        $bp_meta = $bp_user_signup_meta;
    112118    } else {
    113119        $bp_meta = $meta;
     
    124130    global $current_site, $active_signup;
    125131    global $wp_upload_error;
     132    global $bp_user_signup_meta;
    126133
    127134    if ( $_POST['stage'] != 'validate-user-signup' ) return;
    128    
     135
    129136    $counter = 0;
    130137    $bp_signup_has_errors = false;
     
    176183   
    177184    // validate the avatar upload if there is one.
    178     $avatar_error = false;
     185    $bp_signup_avatar_has_errors = false;
    179186    $checked_upload = false;
    180187    $checked_size = false;
     
    222229    }
    223230
    224     if ( !$bp_signup_has_errors && !$bp_signup_avatar_has_errors ) {
    225         /* Destroy and existing cookies */
    226         setcookie( 'bp_xprofile_meta', false, time()-1000, COOKIEPATH );
    227        
     231    if ( !$bp_signup_has_errors && !$bp_signup_avatar_has_errors ) {       
    228232        $public = (int) $_POST['blog_public'];
    229233       
    230234        // put the user profile meta in a session ready to store.
    231235        for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) {
    232             $bp_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
    233         }
    234 
    235         $bp_meta['xprofile_field_ids'] = $_POST['xprofile_ids'];
    236         $bp_meta['avatar_image_resized'] = $canvas;
    237         $bp_meta['avatar_image_original'] = $original;
    238        
    239         setcookie( 'bp_xprofile_meta', serialize($bp_meta), time()+60*60*24, COOKIEPATH );
     236            $bp_user_signup_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
     237        }
     238
     239        $bp_user_signup_meta['xprofile_field_ids'] = $_POST['xprofile_ids'];
     240        $bp_user_signup_meta['avatar_image_resized'] = $canvas;
     241        $bp_user_signup_meta['avatar_image_original'] = $original;
     242       
     243        setcookie( 'bp_xprofile_meta', serialize($bp_user_signup_meta), time()+60*60*24, COOKIEPATH );
    240244    }
    241245}
     
    246250   
    247251    if ( $_POST['stage'] != 'validate-blog-signup' ) return;
    248 
     252   
    249253    $blog_meta = array(
    250254        'public' => $_POST['blog_public'],
     
    277281
    278282
    279 function xprofile_on_activate_user( $user_id, $password, $meta ) {
     283function xprofile_on_activate_user( $user_id, $password, $meta ) { 
    280284    xprofile_extract_signup_meta( $user_id, $meta );
    281285   
Note: See TracChangeset for help on using the changeset viewer.