Skip to:
Content

BuddyPress.org

Ticket #4187: 4187.patch

File 4187.patch, 2.1 KB (added by DJPaul, 13 years ago)
  • bp-members/bp-members-screens.php

    function bp_core_screen_signup() { 
    163163                                // Let's compact any profile field info into usermeta
    164164                                $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
    165165
    166                                 // Loop through the posted fields formatting any datebox values then add to usermeta
     166                                // Loop through the posted fields formatting any datebox values then add to usermeta - @todo This logic should be shared with the same in xprofile_screen_edit_profile()
    167167                                foreach ( (array) $profile_field_ids as $field_id ) {
    168                                         if ( !isset( $_POST['field_' . $field_id] ) ) {
    169                                                 if ( isset( $_POST['field_' . $field_id . '_day'] ) )
    170                                                         $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] ) );
     168                                        if ( ! isset( $_POST['field_' . $field_id] ) ) {
     169
     170                                                if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {
     171                                                        // Concatenate the values
     172                                                        $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
     173
     174                                                        // Turn the concatenated value into a timestamp
     175                                                        $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );
     176                                                }
    171177                                        }
    172178
    173179                                        if ( !empty( $_POST['field_' . $field_id] ) )
    function bp_core_screen_signup() { 
    195201                                else
    196202                                        $wp_user_id = bp_core_signup_user( $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta );
    197203
    198                                 if ( is_wp_error( $wp_user_id ) ) {                                     
     204                                if ( is_wp_error( $wp_user_id ) ) {
    199205                                        $bp->signup->step = 'request-details';
    200206                                        bp_core_add_message( $wp_user_id->get_error_message(), 'error' );
    201207                                } else {