[buddypress-trac] [BuddyPress Trac] #6091: Duplicate xprofile fields when using object cache

buddypress-trac noreply at wordpress.org
Wed Jan 7 16:42:42 UTC 2015


#6091: Duplicate xprofile fields when using object cache
--------------------------+-----------------------------
 Reporter:  lakrisgubben  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  XProfile      |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I'm having the same problem as described here:
 https://buddypress.org/support/topic/duplicated-xprofile-fields/ and after
 searching for the problem it definitely has to do with using an object
 cache.

 The problem is in bp-xprofile-classes.php and has to with the fact that on
 row 299 to 303 the list of group fields are just added to without checking
 if the field already exists.

 My solution, which seems to work is replacing the current code with


 {{{
                         $populated_fields = wp_list_pluck(
 $groups[$index]->fields, 'id' );

                         foreach( (array) $fields as $field ) {
                                 if ( $group->id == $field->group_id && !
 in_array( $field->id, $populated_fields ) ) {
                                         $groups[$index]->fields[] =
 $field;
                                 }
                         }
 }}}

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


More information about the buddypress-trac mailing list