Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/26/2020 02:11:53 PM (4 years ago)
Author:
boonebgorges
Message:

Declare $get_data = false when calling xprofile_get_field().

The default value of $get_data is true, which means that when calling
xprofile_get_field() with no explicit $user_id, but with a logged-in user,
BP_XProfile_Field::populate() will attempt to fetch the user's data. This
is usually neither intended nor needed, and results in unnecessary database
overhead.

See #8378.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r12725 r12768  
    272272
    273273                                    // Load the field.
    274                                     $field = xprofile_get_field( $field->id );
     274                                    $field = xprofile_get_field( $field->id, null, false );
    275275
    276276                                    $class = '';
     
    479479        $field = new BP_XProfile_Field();
    480480    } else {
    481         $field = xprofile_get_field( $field_id );
     481        $field = xprofile_get_field( $field_id, null, false );
    482482    }
    483483
     
    616616    // Handle the deletion of field
    617617    } else {
    618         $field = xprofile_get_field( $field_id );
     618        $field = xprofile_get_field( $field_id, null, false );
    619619
    620620        if ( !$field->delete( (bool) $delete_data ) ) {
     
    651651    }
    652652
    653     $field = xprofile_get_field( $field_id );
     653    $field = xprofile_get_field( $field_id, null, false );
    654654
    655655    $base_url = remove_query_arg( array( 'mode', 'field_id', 'bp_xprofile_delete_field' ), $_SERVER['REQUEST_URI'] ); ?>
Note: See TracChangeset for help on using the changeset viewer.