Skip to:
Content

BuddyPress.org

Changeset 5144


Ignore:
Timestamp:
09/12/2011 08:43:45 PM (15 years ago)
Author:
boonebgorges
Message:

Ensure that empty arrays don't count as field data when querying using hide_empty_fields in the xprofile query class. Fixes #3572.

File:
1 edited

Legend:

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

    r5096 r5144  
    175175                                // Loop through the results and find the fields that have data.
    176176                                foreach( (array)$field_data as $data ) {
    177                                         if ( false !== $key = array_search( $data->field_id, $field_ids ) ) {
     177                                        // Empty fields may contain a serialized empty array
     178                                        $maybe_value = maybe_unserialize( $data->value );
     179                                        if ( !empty( $maybe_value ) && false !== $key = array_search( $data->field_id, $field_ids ) ) {
    178180                                                // Fields that have data get removed from the list
    179181                                                unset( $field_ids[$key] );
Note: See TracChangeset for help on using the changeset viewer.