Opened 8 years ago
Closed 8 years ago
#7481 closed defect (bug)
Check for existence of requested field before attempting field type filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Members | Keywords: | |
Cc: |
Description
This is a follow-up to #6165.
If there are xprofile fields defined but without a value, the call in bp-members/bp-members-template.php: bp_get_member_profile_data() to apply the "bp_get_member_profile_data_<field_type>" filters will cause a PHP Notice for an undefined index.
Adding a condition check before attempting to apply "bp_get_member_profile_data_<field_type>" filters would prevent the notice when a member does not have a value for the requested field.
For example,
if (!empty($profile_data[$r['field']])) { $data = apply_filters( 'bp_get_member_profile_data_' . $profile_data[ $r['field'] ]['field_type'], $data, $r ); }
Change History (4)
Note: See
TracTickets for help on using
tickets.
I am curious what situations would result in empty fields for this.