Skip to:
Content

BuddyPress.org

Changeset 7489


Ignore:
Timestamp:
11/01/2013 03:14:27 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Add empty() checks to avoid debug notices when fetching profile fields from an empty field group.

File:
1 edited

Legend:

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

    r7420 r7489  
    189189
    190190                        // Remove data-less fields, if necessary
    191                         if ( !empty( $hide_empty_fields ) ) {
     191                        if ( !empty( $hide_empty_fields ) && ! empty( $field_ids ) && ! empty( $field_data ) ) {
    192192
    193193                                // Loop through the results and find the fields that have data.
     
    211211                                // Reset indexes
    212212                                $fields = array_values( $fields );
    213 
    214213                        }
    215214
    216215                        // Field data was found
    217                         if ( !empty( $field_data ) && !is_wp_error( $field_data ) ) {
     216                        if ( ! empty( $fields ) && !empty( $field_data ) && !is_wp_error( $field_data ) ) {
    218217
    219218                                // Loop through fields
     
    225224                                                // Assign correct data value to the field
    226225                                                if ( $field->id == $data->field_id ) {
    227                                                         $fields[$field_key]->data = new stdClass;
     226                                                        $fields[$field_key]->data        = new stdClass;
    228227                                                        $fields[$field_key]->data->value = $data->value;
    229                                                         $fields[$field_key]->data->id = $data->id;
     228                                                        $fields[$field_key]->data->id    = $data->id;
    230229                                                }
    231230                                        }
Note: See TracChangeset for help on using the changeset viewer.