Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/26/2020 02:11:53 PM (13 months 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-caps.php

    r11301 r12768  
    8686    if ( 'bp_xprofile_change_field_visibility' === $capability && 0 === $user_id ) {
    8787        $field_id = bp_get_the_profile_field_id();
    88         if ( $field_id && $field = xprofile_get_field( $field_id ) ) {
     88        if ( $field_id && $field = xprofile_get_field( $field_id, null, false ) ) {
    8989            $user_can = 'allowed' === $field->allow_custom_visibility;
    9090        }
Note: See TracChangeset for help on using the changeset viewer.