Skip to:
Content

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#7300 closed defect (bug) (fixed)

xprofile date field year regression on existing fields

Reported by: DJPaul Owned by: 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 15 months ago.
7300.diff (845 bytes) - added by DJPaul 15 months ago.

Download all attachments as: .zip

Change History (10)

#1 @DJPaul
15 months ago

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

#2 @DJPaul
15 months ago

Unsurprisingly, this problem was introduced by r11041.

@DJPaul
15 months ago

#3 @DJPaul
15 months 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
15 months ago

Patch attached (for trunk -- I guess for branch, we keep the IF structure since PHP 5.2).

Last edited 15 months ago by DJPaul (previous) (diff)

#5 @boonebgorges
15 months 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
15 months 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
15 months 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
15 months ago

New ticket #7306 for the PHPDoc

Note: See TracTickets for help on using tickets.