Changeset 2946 for trunk/bp-core/bp-core-signup.php
- Timestamp:
- 04/21/2010 11:34:12 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-signup.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-signup.php
r2925 r2946 54 54 $bp->signup->email = $_POST['signup_email']; 55 55 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' ); 65 75 } 66 76 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 ); 69 80 } 70 81 } … … 252 263 253 264 if ( empty( $user_name ) ) 254 $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );265 $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) ); 255 266 256 267 $maybe = array(); … … 260 271 $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', BP_GROUPS_SLUG, $bp->members->slug, BP_FORUMS_SLUG, BP_BLOGS_SLUG, BP_REGISTER_SLUG, BP_ACTIVATION_SLUG ) ); 261 272 262 $illegal_names = array_merge( (array)$db_illegal_names, (array)$filtered_illegal_names ); 273 /* Safely merge our illegal names into existing site_option */ 274 $common_names = array_intersect( (array)$db_illegal_names, (array)$filtered_illegal_names ); 275 $diff_names = array_diff( (array)$db_illegal_names, (array)$filtered_illegal_names ); 276 $illegal_names = array_merge( (array)$diff_names, (array)$common_names ); 277 263 278 update_site_option( 'illegal_names', $illegal_names ); 264 279 … … 267 282 268 283 if ( !validate_username( $user_name ) || $user_name != $maybe[0] ) 269 $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );284 $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) ); 270 285 271 286 if( strlen( $user_name ) < 4 ) 272 $errors->add( 'user_name', __( 'Username must be at least 4 characters', 'buddypress' ) );287 $errors->add( 'user_name', __( 'Username must be at least 4 characters', 'buddypress' ) ); 273 288 274 289 if ( strpos( ' ' . $user_name, '_' ) != false ) … … 385 400 386 401 function bp_core_activate_signup( $key ) { 387 global $ wpdb;402 global $bp, $wpdb; 388 403 389 404 $user = false; … … 558 573 559 574 if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) ) 560 wp_redirect( bp_get_root_domain() . '/' . BP_REGISTER_SLUG . '/' );575 bp_core_redirect( bp_get_root_domain() . '/' . BP_REGISTER_SLUG . '/' ); 561 576 } 562 577 if ( bp_core_is_multisite() )
Note: See TracChangeset
for help on using the changeset viewer.