Skip to:
Content

BuddyPress.org

Changeset 10226


Ignore:
Timestamp:
10/10/2015 12:43:56 PM (9 years ago)
Author:
djpaul
Message:

xprofile: fix PHP error on wp-admin Profile Fields screen

If a field ID is passed to the BuddyPress_XProfile_Field constructor,
that object is populated with that fields data. If the field ID is not
set (null), an empty profile field object would still be returned.

The change in r10200 to using xprofile_get_field does not (and should
not) return an empty profile field object if the field ID argument is
null, so this change adds appropriate handling for this situation.

Fixes #10200

File:
1 edited

Legend:

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

    r10200 r10226  
    330330    $bp = buddypress();
    331331
    332     $field           = xprofile_get_field( $field_id );
     332    if ( is_null( $field_id ) ) {
     333        $field = new BP_XProfile_Field();
     334    } else {
     335        $field = xprofile_get_field( $field_id );
     336    }
     337
    333338    $field->group_id = $group_id;
    334339
Note: See TracChangeset for help on using the changeset viewer.