Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/19/2010 02:31:29 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2290

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-signup.php

    r2930 r2932  
    5454                $bp->signup->email = $_POST['signup_email'];
    5555
    56                 if ( !empty( $_POST['signup_profile_field_ids'] ) && function_exists( 'xprofile_check_is_required_field' ) ) {
    57                         /* Now we've checked account details, we can check profile information */
    58                         $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
    59 
    60                         /* Loop through the posted fields formatting any datebox values then validate the field */
    61                         foreach ( (array) $profile_field_ids as $field_id ) {
    62                                 if ( !isset( $_POST['field_' . $field_id] ) ) {
    63                                         if ( isset( $_POST['field_' . $field_id . '_day'] ) )
    64                                                 $_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
     56                /* Now we've checked account details, we can check profile information */
     57                if ( function_exists( 'xprofile_check_is_required_field' ) ) {
     58
     59                        /* Make sure hidden field is passed and populated */
     60                        if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {
     61
     62                                /* Let's compact any profile field info into an array */
     63                                $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
     64
     65                                /* Loop through the posted fields formatting any datebox values then validate the field */
     66                                foreach ( (array) $profile_field_ids as $field_id ) {
     67                                        if ( !isset( $_POST['field_' . $field_id] ) ) {
     68                                                if ( isset( $_POST['field_' . $field_id . '_day'] ) )
     69                                                        $_POST['field_' . $field_id] = strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] );
     70                                        }
     71
     72                                        /* Create errors for required fields without values */
     73                                        if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
     74                                                $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
    6575                                }
    6676
    67                                 if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
    68                                         $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
     77                        /* This situation doesn't naturally occur so bounce to website root */
     78                        } else {
     79                                bp_core_redirect( $bp->root_domain );
    6980                        }
    7081                }
Note: See TracChangeset for help on using the changeset viewer.