Changeset 2645
- Timestamp:
- 02/10/2010 03:24:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile.php
r2576 r2645 299 299 $posted_field_ids = explode( ',', $_POST['field_ids'] ); 300 300 301 $is_required = array(); 302 301 303 /* Loop through the posted fields formatting any datebox values then validate the field */ 302 304 foreach ( (array)$posted_field_ids as $field_id ) { … … 315 317 } 316 318 317 if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) ) 319 $is_required[$field_id] = xprofile_check_is_required_field( $field_id ); 320 if ( $is_required[$field_id] && empty( $_POST['field_' . $field_id] ) ) 318 321 $errors = true; 319 322 } … … 327 330 /* Now we've checked for required fields, lets save the values. */ 328 331 foreach ( (array)$posted_field_ids as $field_id ) { 329 if ( !xprofile_set_field_data( $field_id, $bp->displayed_user->id, $_POST['field_' . $field_id] ) )332 if ( !xprofile_set_field_data( $field_id, $bp->displayed_user->id, $_POST['field_' . $field_id], $is_required[$field_id] ) ) 330 333 $errors = true; 331 334 else … … 710 713 * @return true on success, false on failure. 711 714 */ 712 function xprofile_set_field_data( $field, $user_id, $value ) {715 function xprofile_set_field_data( $field, $user_id, $value, $is_required = false ) { 713 716 if ( is_numeric( $field ) ) 714 717 $field_id = $field; … … 719 722 return false; 720 723 721 if ( empty( $value ) || !strlen( trim( $value) ) )724 if ( $is_required && ( empty( $value ) || !strlen( trim( $value ) ) ) ) 722 725 return false; 723 726
Note: See TracChangeset
for help on using the changeset viewer.