#8743 closed defect (bug) (worksforme)
xprofile_set_field_data it's not working on "Date selector"
Reported by: | marioshtika | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: |
Description
Hello,
I am setting some field data programmatically using the xprofile_set_field_data
function, as shown below.
xprofile_set_field_data(5, 21, '2017-12-03 07:53:00');
It is working fine when the field is set as a text box.
But If I change the field type to Date Selector, it is not saving it and it's returning false.
Is this a bug in there, or am I doing something wrong?
I didn't find any documentation that I have to use xprofile_set_field_data
differently according to its type.
Thank you in advance
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi,
That's because the pattern we use to validate a date is expecting the time to be
00:00:00
, see line 31 of this file https://buddypress.trac.wordpress.org/browser/trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php#L31If you use
xprofile_set_field_data(5, 21, '2017-12-03 00:00:00');
it should work as expected.Thanks for posting this ticket, we're never too sure whether something weird is a bug or not 😅 As we don't handle time into this field type, I believe it's not a bug.