Skip to:
Content

BuddyPress.org

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: sfinnerty's profile sfinnerty 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)

#1 @hnla
8 years ago

  • Keywords dev-feedback needs-patch added

#2 @tw2113
8 years ago

I am curious what situations would result in empty fields for this.

#3 @hnla
8 years ago

It is possible to empty a field but the index would still be set? Question might be is there an issue setting a check regardless?

#4 @r-a-y
8 years ago

  • Keywords dev-feedback needs-patch removed
  • Milestone Awaiting Review deleted
  • Status changed from new to closed
  • Version 2.8.2 deleted

Duplicate of #7516.

Note: See TracTickets for help on using tickets.