Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/28/2014 06:23:15 PM (9 years ago)
Author:
djpaul
Message:

xProfile: fix profile fields not rendering if their value is "0".

This was caused by a reliance on the empty() function in a few places, which was causing us to
not handle "0" (both as int and string) as a valid field value. In turn, this was causing the
profile field template loop to skip rendering the affected field.

Fixes #5731, props DJPaul and r-a-y.

File:
1 edited

Legend:

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

    r8547 r8554  
    228228                    // Empty fields may contain a serialized empty array
    229229                    $maybe_value = maybe_unserialize( $data->value );
    230                     if ( !empty( $maybe_value ) && false !== $key = array_search( $data->field_id, $field_ids ) ) {
     230
     231                    // Valid field values of 0 or '0' get caught by empty(), so we have an extra check for these. See #BP5731
     232                    if ( ( ! empty( $maybe_value ) || '0' == $maybe_value ) && false !== $key = array_search( $data->field_id, $field_ids ) ) {
     233
    231234                        // Fields that have data get removed from the list
    232235                        unset( $field_ids[$key] );
Note: See TracChangeset for help on using the changeset viewer.