Changeset 10948
- Timestamp:
- 07/20/2016 05:51:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r10877 r10948 204 204 } 205 205 206 $bp = buddypress(); 207 $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id ) ); 206 $field = wp_cache_get( $id, 'bp_xprofile_fields' ); 207 if ( false === $field ) { 208 $bp = buddypress(); 209 210 $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id ) ); 211 212 if ( ! $field ) { 213 return false; 214 } 215 216 wp_cache_add( $id, $field, 'bp_xprofile_fields' ); 217 } 208 218 209 219 $this->fill_data( $field ); … … 232 242 } 233 243 234 $field = wp_cache_get( $field_id, 'bp_xprofile_fields' ); 235 if ( false === $field ) { 236 $bp = buddypress(); 237 238 $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ) ); 239 240 if ( ! $field ) { 241 return false; 242 } 243 244 wp_cache_add( $field->id, $field, 'bp_xprofile_fields' ); 245 } 246 247 $_field = new BP_XProfile_Field(); 248 $_field->fill_data( $field ); 249 250 return $_field; 244 return new self( $field_id ); 251 245 } 252 246
Note: See TracChangeset
for help on using the changeset viewer.