Ticket #7114: 7114.01.patch
File 7114.01.patch, 1.4 KB (added by , 8 years ago) |
---|
-
src/bp-xprofile/classes/class-bp-xprofile-field.php
203 203 $user_id = isset( $userdata->ID ) ? $userdata->ID : 0; 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 ); 210 220 … … 231 241 return false; 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 253 247 /**