Opened 2 years ago
Closed 17 months ago
#8789 closed defect (bug) (fixed)
bp_get_the_profile_field_ids should check that groups exist
Reported by: | shawfactor | Owned by: | imath |
---|---|---|---|
Milestone: | 12.0.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Extended Profile | Keywords: | has-patch has-unit-tests |
Cc: |
Description
The bp_get_the_profile_field_ids function should incorporate a check that $profile_template->groups before the foreach loop. At present when you use it programmatically it can generate an error in some contexts
this would be an improvement:
if (!empty($profile_template->groups)){
foreach ( $profile_template->groups as $group ) {
if ( ! empty( $group->fields ) ) {
$field_ids = array_merge( $field_ids, wp_list_pluck( $group->fields, 'id' ) );
}
}
}
Change History (5)
Note: See
TracTickets for help on using
tickets.
Prevent potential errors in
bp_get_the_profile_field_ids()
.Trac ticket: https://buddypress.trac.wordpress.org/ticket/8789