Changeset 12904 for trunk/src/bp-core/bp-core-update.php
- Timestamp:
- 04/23/2021 11:37:10 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-update.php
r12898 r12904 554 554 555 555 /** 556 * Retuns needed the fullname field ID for an update task. 557 * 558 * @since 8.0.0 559 * 560 * @return int The fullname field ID. 561 */ 562 function bp_get_fullname_field_id_for_update() { 563 /** 564 * The xProfile component is active by default on new installs, even if it 565 * might be inactive during this update, we need to set the custom visibility 566 * for the default field, in case the Administrator decides to reactivate it. 567 */ 568 global $wpdb; 569 $bp_prefix = bp_core_get_table_prefix(); 570 return (int) $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE name = %s", addslashes( bp_get_option( 'bp-xprofile-fullname-field-name' ) ) ) ); 571 } 572 573 /** 556 574 * 5.0.0 update routine. 557 575 * … … 570 588 global $wpdb; 571 589 $bp_prefix = bp_core_get_table_prefix(); 572 $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE name = %s", addslashes( bp_get_option( 'bp-xprofile-fullname-field-name' ) ) ));590 $field_id = bp_get_fullname_field_id_for_update(); 573 591 574 592 $wpdb->insert( … … 624 642 ); 625 643 626 if ( bp_get_signup_allowed() ) { 644 // Check if we need to create default signup fields. 645 $field_id = bp_get_fullname_field_id_for_update(); 646 $has_signup_position = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$bp_prefix}bp_xprofile_meta WHERE meta_key = 'signup_position' AND object_type = 'field' AND object_id = %d", $field_id ) ); 647 if ( bp_get_signup_allowed() && ! $has_signup_position ) { 627 648 // Get the Primary Group's fields. 628 649 $signup_fields = $wpdb->get_col( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE group_id = 1 ORDER BY field_order ASC" );
Note: See TracChangeset
for help on using the changeset viewer.