Opened 9 years ago
Closed 9 years ago
#7516 closed defect (bug) (fixed)
bp_member_profile_data( 'field=Non existing fields' )
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.9 | Priority: | normal |
| Severity: | normal | Version: | 2.7 |
| Component: | Members | Keywords: | has-patch |
| Cc: |
Description
Hi, if you want to output a field that doesn't exist or the user hasn't yet completed you will get a PHP notice:
Notice: Undefined index: plugins/buddypress/bp-members/bp-members-template.php on line 1162
Attachments (1)
Change History (10)
#2
@
9 years ago
- Keywords 2nd-opinion added
- Milestone changed from Awaiting Review to 2.9
Lets bring it in to 2.9 and get a second-opinion of fix then.
This ticket was mentioned in Slack in #buddypress by hnla. View the logs.
9 years ago
#4
@
9 years ago
- Component changed from Core to Members
- Keywords has-patch added; 2nd-opinion removed
- Version set to 2.7
01.patch should fix this up.
#6
@
9 years ago
Do we perhaps want to change it to have a filter of bp_get_member_profile_data by default and then conditionally append the rest?
$filter = 'bp_get_member_profile_data';
if ( ! empty( $profile_data[ $r['field'] ]['field_type'] ) ) {
$filter .= "_{$profile_data[ $r['field'] ]['field_type']}";
}
$data = apply_filters( $filter, $data, $r )
This way, it at least gets "bp_get_member_profile_data" available as a filter. Just a thought.
I can definitely see this happening, since this is the line in question:
$data = apply_filters( 'bp_get_member_profile_data_' . $profile_data[ $r['field'] ]['field_type'], $data, $r );No isset checks at that point. Logically, in those cases, it's going to produce a filter name of
bp_get_member_profile_data_without anything after the trailing _That said, it's hard to say if we want to try and default to a specific value or perhaps return early with a false value?