Changeset 12868 for trunk/src/bp-xprofile/bp-xprofile-admin.php
- Timestamp:
- 03/21/2021 02:17:21 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-admin.php
r12768 r12868 494 494 $field->name = $_POST['title']; 495 495 496 /* 497 * By default a Textbox field is created. To run field type's feature 498 * checks we need to set it to what it really is early. 499 */ 500 if ( is_null( $field_id ) ) { 501 $field_type = bp_xprofile_create_field_type( $field->type ); 502 503 // If it's a placeholder, then the field type is not registered. 504 if ( ! $field_type instanceof BP_XProfile_Field_Type_Placeholder ) { 505 $field->type_obj = $field_type; 506 } 507 } 508 509 if ( ! $field->field_type_supports( 'required' ) ) { 510 $field->is_required = "0"; 511 } 512 496 513 if ( ! empty( $_POST['description'] ) ) { 497 514 $field->description = $_POST['description']; … … 538 555 // Validate default visibility. 539 556 if ( ! empty( $_POST['default-visibility'] ) && in_array( $_POST['default-visibility'], wp_list_pluck( bp_xprofile_get_visibility_levels(), 'id' ) ) ) { 540 bp_xprofile_update_field_meta( $field_id, 'default_visibility', $_POST['default-visibility'] ); 557 $default_visibility = $_POST['default-visibility']; 558 559 if ( ! $field->field_type_supports( 'allow_custom_visibility' ) ) { 560 $default_visibility = 'public'; 561 } 562 563 bp_xprofile_update_field_meta( $field_id, 'default_visibility', $default_visibility ); 541 564 } 542 565 543 566 // Validate custom visibility. 544 567 if ( ! empty( $_POST['allow-custom-visibility'] ) && in_array( $_POST['allow-custom-visibility'], array( 'allowed', 'disabled' ) ) ) { 545 bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $_POST['allow-custom-visibility'] ); 568 $allow_custom_visibility = $_POST['allow-custom-visibility']; 569 570 if ( ! $field->field_type_supports( 'allow_custom_visibility' ) ) { 571 $allow_custom_visibility = 'disabled'; 572 } 573 574 bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $allow_custom_visibility ); 546 575 } 547 576 … … 553 582 } 554 583 584 $do_autolink = ''; 585 if ( $field->field_type_supports( 'do_autolink' ) && isset( $_POST['do_autolink'] ) && $_POST['do_autolink'] ) { 586 $do_autolink = wp_unslash( $_POST['do_autolink'] ); 587 } 588 555 589 // Save autolink settings. 556 if ( isset( $_POST['do_autolink'] ) && 'on' === wp_unslash( $_POST['do_autolink'] )) {590 if ( 'on' === $do_autolink ) { 557 591 bp_xprofile_update_field_meta( $field_id, 'do_autolink', 'on' ); 558 592 } else {
Note: See TracChangeset
for help on using the changeset viewer.