[buddypress-trac] [BuddyPress] #3074: XProfile - Incorrect CSS zebra striping

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Jul 26 16:16:26 UTC 2011


#3074: XProfile - Incorrect CSS zebra striping
-----------------------+-----------------------
 Reporter:  ezd        |       Owner:
     Type:  defect     |      Status:  reopened
 Priority:  normal     |   Milestone:  1.3
Component:  Theme      |     Version:  1.3
 Severity:  normal     |  Resolution:
 Keywords:  has-patch  |
-----------------------+-----------------------

Comment (by boonebgorges):

 Two things:

 - The way xprofile data is stored, the following queries are (I believe)
 the same:

  {{{SELECT field_id, value FROM $bp->profile->table_name_data WHERE
 field_id IN ( { $field_ids_sql } ) AND user_id = %d;}}}
  {{{SELECT field_id, value FROM $bp->profile->table_name_data WHERE
 field_id IN ( { $field_ids_sql } ) AND user_id = %d AND field_id != '' AND
 field_id IS NOT NULL;}}}

  That's because xprofile does not save blank rows. So, say there is an
 optional profile field called "School", with field_id = 5. When I save my
 profile, if I do not provide a value for School, xprofile skips it. It
 does *not* save a row that looks like this:
 +----+----------+---------+------------------------+---------------------+
  | id | field_id | user_id | value                  | last_updated
 |
 +----+----------+---------+------------------------+---------------------+
  | 10 |        5 |       1 |                        | 2011-07-26 16:10:41
 |

  That's what I mean by "no blank rows are saved". So your
 $hide_empty_fields clause doesn't do anything, because there will never be
 rows with a blank value.

 - The second issue is that we want to hide empty FIELDS, not empty FIELD
 DATA. $fields is populated by a *separate query*, several lines before
 $field_data is populated. If we want to hide empty fields, then we either
 need to turn this into a single query with a directional join (so that
 fields are skipped when there is no corresponding data in the data field),
 or we need to loop through $fields *after* querying for $field_data, and
 unset individual fields based on $field_data. That's what 3074.03.patch
 does.

 This is a bit complicated, hope I've explained it properly :) It might be
 easier if you just do a var_dump of $groups just before it's returned by
 BP_Xprofile_Group::get() - you'll see that your method leaves dataless
 fields, even with your additional query clause.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3074#comment:13>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list