Changeset 9986
- Timestamp:
- 07/02/2015 01:25:25 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r9983 r9986 276 276 do_action_ref_array( 'xprofile_field_before_save', array( $this ) ); 277 277 278 if ( $this->id != null ) { 278 $is_new_field = is_null( $this->id ); 279 280 if ( ! $is_new_field ) { 279 281 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d, option_order = %d, can_delete = %d, is_default_option = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->option_order, $this->can_delete, $this->is_default_option, $this->id ); 280 282 } else { … … 288 290 if ( $wpdb->query( $sql ) !== null ) { 289 291 290 if ( ! empty( $this->id ) ) { 291 $field_id = $this->id; 292 } else { 293 $field_id = $wpdb->insert_id; 292 if ( $is_new_field ) { 293 $this->id = $wpdb->insert_id; 294 294 } 295 295 296 296 // Only do this if we are editing an existing field 297 if ( $this->id != null) {297 if ( ! $is_new_field ) { 298 298 299 299 /** … … 312 312 if ( $this->type_obj->supports_options ) { 313 313 314 if ( !empty( $this->id ) ) { 315 $parent_id = $this->id; 316 } else { 317 $parent_id = $wpdb->insert_id; 318 } 314 $parent_id = $this->id; 319 315 320 316 // Allow plugins to filter the field's child options (i.e. the items in a selectbox). … … 381 377 $this->type_obj = bp_xprofile_create_field_type( $this->type ); 382 378 $this->type_obj->field_obj = $this; 383 384 // If this is a new field, set the `id` property of the current object.385 if ( empty( $this->id ) ) {386 $this->id = $field_id;387 }388 379 389 380 return $this->id;
Note: See TracChangeset
for help on using the changeset viewer.