[buddypress-trac] [BuddyPress Trac] #6638: XProfile fields should have cache support

buddypress-trac noreply at wordpress.org
Wed Oct 7 04:28:18 UTC 2015

#6638: XProfile fields should have cache support
 Reporter:  boonebgorges          |       Owner:
     Type:  enhancement           |      Status:  new
 Priority:  normal                |   Milestone:  2.4
Component:  Component - XProfile  |     Version:
 Severity:  normal                |  Resolution:
 Keywords:  has-patch             |
Changes (by boonebgorges):

 * keywords:  has-patch 2nd-opinion => has-patch


 Replying to [comment:5 r-a-y]:

 > My only concern is in `BP_XProfile_Group::get()`.
 > On line 386 of `class-bp-xprofile-group.php`, in the `foreach (
 $uncached_fields as $uncached_field )` block, you are caching
 `$uncached_field` in the `'bp_xprofile_fields'` cachegroup.  At this
 stage, `$uncached_field` is not a complete row from the
 `$bp->profile->table_name_fields` table as it should be (see
 `BP_XProfile_Field::get_instance()` where the initial cache is set).
 > Should the entire block from line 381-390 be removed?
 > The reason I say this is further down on line 394, you grab the fields
 again via field ID, which should trigger the cache to be set if it isn't
 already via `xprofile_get_field( $field_id )` =>

 Ah, good catch. The reason for lines 381-390 is to fetch data for all
 uncached fields in a single database query. If we wait until
 `xprofile_get_field( $field_id )`, it'll be done one field at a time - 10
 possible queries. But you're right that there's an error: it should
 probably be `SELECT * FROM ...` instead of `SELECT id, name,
 description...`. Then the rows will be complete.

 Stripslashes changes look good. Thanks for noticing that.

 I'm going to sleep on this and probably go for it tomorrow. Thanks to you
 and to DJPaul for having a look!

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6638#comment:6>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list