[buddypress-trac] [BuddyPress Trac] #8789: bp_get_the_profile_field_ids should check that groups exist

buddypress-trac noreply at wordpress.org
Tue Jan 3 01:25:48 UTC 2023


#8789: bp_get_the_profile_field_ids should check that groups exist
--------------------------+-----------------------------
 Reporter:  shawfactor    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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' ) );
                         }
                 }

 }

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8789>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list