Skip to:
Content

BuddyPress.org

Changeset 6083


Ignore:
Timestamp:
06/13/2012 08:15:04 PM (12 years ago)
Author:
djpaul
Message:

Stop date fields on the registration template defaulting to the unix epoch if field left empty. See #4187.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-screens.php

    r5860 r6083  
    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
     
    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' );
Note: See TracChangeset for help on using the changeset viewer.