Skip to:
Content

BuddyPress.org

Changeset 12888


Ignore:
Timestamp:
04/16/2021 06:49:37 PM (5 years ago)
Author:
imath
Message:

xProfile: skip caching existing data about fields of the WP field type

This allows existing xProfile fields to be converted from the textbox to the wp-textbox type (for example) by ignoring any pre-existing values retrieved by the uncached data query.

This commit also prevents the WordPress xProfile field $table_name property from being cleared prior to priming the cache.

Props needle

Fixes #8455

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    r12869 r12888  
    358358
    359359                // If a value was found, cache it.
    360                 if ( isset( $queried_data[ $field_id ] ) ) {
     360                if ( isset( $queried_data[ $field_id ] ) && ! isset( $field_type_objects[ $field_id ]->wp_user_key ) ) {
    361361                    wp_cache_set( $cache_key, $queried_data[ $field_id ], 'bp_xprofile_data' );
    362362
     
    366366                    $d = new stdClass;
    367367
    368                     // Check WordPress if it's a WordPress field.
     368                    // Check if it's a WordPress field.
    369369                    if ( isset( $field_type_objects[ $field_id ]->wp_user_key ) ) {
    370370                        $meta          = $field_type_objects[ $field_id ]->get_field_value( $user_id, $field_id );
     
    374374
    375375                    } else {
    376                         $d->id    = '';
    377                         $d->value = '';
     376                        $d->id         = '';
     377                        $d->value      = '';
     378                        $d->table_name = '';
    378379                    }
    379380
    380                     $d->table_name   = '';
    381381                    $d->user_id      = $user_id;
    382382                    $d->field_id     = $field_id;
Note: See TracChangeset for help on using the changeset viewer.