Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7300 closed defect (bug) (fixed)

xprofile date field year regression on existing fields

Reported by: djpaul's profile DJPaul Owned by: djpaul's profile djpaul
Milestone: 2.7.1 Priority: high
Severity: major Version:
Component: Extended Profile Keywords: commit
Cc:

Description

If you had a date field prior to 2.7 upgrade, the year dropdown box had many values. Post-upgrade, only 2016 is showing (probably related to the current year). You have to go in and edit and resave that field with a date range.

Reported in https://buddypress.org/support/topic/problems-with-xprofile-field-visibilty-on-2-7-0/

Attachments (2)

Screen Shot 2016-10-23 at 10.13.43.png (140.3 KB) - added by DJPaul 8 years ago.
7300.diff (845 bytes) - added by DJPaul 8 years ago.

Download all attachments as: .zip

Change History (10)

#1 @DJPaul
8 years ago

The CSS looks wrong for the Range field, too, per Screen Shot 2016-10-23 at 10.13.43.png.

#2 @DJPaul
8 years ago

Unsurprisingly, this problem was introduced by r11041.

@DJPaul
8 years ago

#3 @DJPaul
8 years ago

Because existing fields do not have the new meta properties set, the requested field values were being returned from meta as a empty string, not a boolean false, and the type strictness of this check caused the value to be set to that empty string, not from the defaults array.

This contradicts our PHPDoc block for bp_xprofile_get_meta which says it returns a boolean false if the request value is not set... which is how WP's https://codex.wordpress.org/Function_Reference/get_user_meta works, so we probably need to go through all our custom meta functions, fix the docblocks, and check other instances we might be handling type strict. This second part itself should be its own ticket, but I want confirmation that I've looked at this correctly first. :)

#4 @DJPaul
8 years ago

Patch attached

Version 0, edited 8 years ago by DJPaul (next)

#5 @boonebgorges
8 years ago

  • Keywords commit added
  • Owner set to djpaul
  • Status changed from new to assigned

Thanks for tracking this down, @DJPaul. Fix looks good to me.

This contradicts our PHPDoc block for bp_xprofile_get_meta which says it returns a boolean false if the request value is not set... which is how WP's https://codex.wordpress.org/Function_Reference/get_user_meta works, so we probably need to go through all our custom meta functions, fix the docblocks, and check other instances we might be handling type strict. This second part itself should be its own ticket, but I want confirmation that I've looked at this correctly first. :)

Ugh. I feel like I specifically looked at this when migrating the meta functions to WP's. I wonder if xprofile is a special case, because it translates object_id. In any case, definitely worth a separate ticket.

#6 @djpaul
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 11210:

xprofile: fix regression being unable to select year in date field type.

Pre-2.7 date fields do not have all of the new field meta properties set, and the requested metas were returned as an empty string, not a boolean false. The type strictness of the check changed in this commit caused the value(s) of the year field to be set to an empty array, instead of picking up the range of dates from the defaults.

This was probably caused by some misleading PHPDoc for bp_xprofile_get_meta, which we're going to look into seperately.

Fixes #7300

#7 @djpaul
8 years ago

In 11211:

xprofile: fix regression being unable to select year in date field type.

Pre-2.7 date fields do not have all of the new field meta properties set, and the requested metas were returned as an empty string, not a boolean false. The type strictness of the check changed in this commit caused the value(s) of the year field to be set to an empty array, instead of picking up the range of dates from the defaults.

This was probably caused by some misleading PHPDoc for bp_xprofile_get_meta, which we're going to look into seperately.

Fixes #7300 (for 2.7 branch)

#8 @DJPaul
8 years ago

New ticket #7306 for the PHPDoc

Note: See TracTickets for help on using tickets.