diff --git src/bp-core/bp-core-update.php src/bp-core/bp-core-update.php
index 1556f6146..f335a20d9 100644
|
|
|
function bp_update_to_2_7() { |
| 552 | 552 | bp_add_option( '_bp_ignore_deprecated_code', false ); |
| 553 | 553 | } |
| 554 | 554 | |
| | 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 | |
| 555 | 573 | /** |
| 556 | 574 | * 5.0.0 update routine. |
| 557 | 575 | * |
| … |
… |
function bp_update_to_5_0() { |
| 569 | 587 | */ |
| 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( |
| 575 | 593 | $bp_prefix . 'bp_xprofile_meta', |
| … |
… |
function bp_update_to_8_0() { |
| 623 | 641 | ) |
| 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" ); |
| 629 | 650 | |