[buddypress-trac] [BuddyPress Trac] #7481: Check for existence of requested field before attempting field type filter
buddypress-trac
noreply at wordpress.org
Thu Mar 23 20:47:31 UTC 2017
#7481: Check for existence of requested field before attempting field type filter
--------------------------+-----------------------------
Reporter: sfinnerty | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Members | Version: 2.8.2
Severity: normal | Keywords:
--------------------------+-----------------------------
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 );
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7481>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list