- Timestamp:
- 10/07/2015 02:30:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php
r10176 r10198 370 370 371 371 // Fetch the fields. 372 $fields = $wpdb->get_results( "SELECT id, name, description, type, group_id, is_required FROM {$bp->profile->table_name_fields} WHERE group_id IN ( {$group_ids_in} ) AND parent_id = 0 {$exclude_fields_sql} {$in_sql} ORDER BY field_order" ); 373 374 $field_ids = wp_list_pluck( $fields, 'id' ); 372 $field_ids = $wpdb->get_col( "SELECT id FROM {$bp->profile->table_name_fields} WHERE group_id IN ( {$group_ids_in} ) AND parent_id = 0 {$exclude_fields_sql} {$in_sql} ORDER BY field_order" ); 373 374 // Bail if no fields. 375 if ( empty( $field_ids ) ) { 376 return $groups; 377 } 378 379 $field_ids = array_map( 'intval', $field_ids ); 380 381 // Prime the field cache. 382 $uncached_field_ids = bp_get_non_cached_ids( $field_ids, 'bp_xprofile_fields' ); 383 if ( ! empty( $uncached_field_ids ) ) { 384 $_uncached_field_ids = implode( ',', array_map( 'intval', $uncached_field_ids ) ); 385 $uncached_fields = $wpdb->get_results( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id IN ({$_uncached_field_ids})" ); 386 foreach ( $uncached_fields as $uncached_field ) { 387 $fid = intval( $uncached_field->id ); 388 wp_cache_set( $fid, $uncached_field, 'bp_xprofile_fields' ); 389 } 390 } 391 392 // Pull field objects from the cache. 393 $fields = array(); 394 foreach ( $field_ids as $field_id ) { 395 $fields[] = xprofile_get_field( $field_id ); 396 } 375 397 376 398 // Store field IDs for meta cache priming. 377 399 $object_ids['field'] = $field_ids; 378 379 // Bail if no fields.380 if ( empty( $fields ) ) {381 return $groups;382 }383 400 384 401 // Maybe fetch field data.
Note: See TracChangeset
for help on using the changeset viewer.