Repository navigation
Abilities API: Return the core/users-query registration date as registered.site and registered.gmt - #15001
Abilities API: Return the core/users-query registration date as registered.site and registered.gmt#15001jorgefilipecosta wants to merge 2 commits into
core/users-query registration date as registered.site and registered.gmt#15001Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| public static function data_unknown_requested_fields(): array { | ||
| return array( | ||
| 'unknown field' => array( 'bogus_field' ), | ||
| 'removed registered_date field' => array( 'registered_date' ), |
There was a problem hiding this comment.
Let's not keep the history of this removed field, since it didn't become part of the public contract.
There was a problem hiding this comment.
Agreed, the registered_date row was removed.
There was a problem hiding this comment.
Thank you, this looks great! The new registered object uses the same { site, gmt } shape and the same field path handling as the date fields in core/content-query. That keeps the two abilities aligned, and clients can handle dates the same way in both.
I also like the improved date handling. user_registered is now always read as UTC, and it no longer depends on the PHP default timezone. The formatter preserves null handling for zero dates and handles timezone conversions that push dates outside the supported four-digit year range. The strict false check also correctly preserves the Unix epoch. The tests for DST, fractional offsets and edge years are very helpful.
The new tests cover the behavior well. I left a few notes on merging some overlapping checks to keep the suite easier to maintain. None of them are blocking.
…gistered.site` and `registered.gmt`. Replaces the `registered_date` user field with a `registered` object holding the registration date in the site's timezone (`site`) and in GMT (`gmt`), like the `core/content-query` date fields. The `fields` input accepts `registered.site` and `registered.gmt` to select a single date, and rejects `registered_date`. See #64657.
…ests. Moves the `registered` output schema checks into the main schema test, checks the `fields` enum in output order there, and drops the tests and data provider rows that the other tests already cover.
604d855 to
f3158d3
Compare
|
Thank you for the review @gziolo, all the feedback was applied and I rebased the PR on trunk to pick up the entity actions test fix 😊 |
…gistered.site` and `registered.gmt`. Replace the `registered_date` field with a `registered` object holding the registration date in the site's timezone (`site`) and in GMT (`gmt`), like the `core/content-query` date fields. The `fields` input accepts `registered.site` and `registered.gmt` to select a single date. Developed in #15001. Follow-up to [64346]. Props jorgefilipecosta, gziolo. See #64657. git-svn-id: https://develop.svn.wordpress.org/trunk@65002 602fd350-edb4-49c9-b593-d223f7449a82
…gistered.site` and `registered.gmt`. Replace the `registered_date` field with a `registered` object holding the registration date in the site's timezone (`site`) and in GMT (`gmt`), like the `core/content-query` date fields. The `fields` input accepts `registered.site` and `registered.gmt` to select a single date. Developed in WordPress/wordpress-develop#15001. Follow-up to [64346]. Props jorgefilipecosta, gziolo. See #64657. Built from https://develop.svn.wordpress.org/trunk@65002 git-svn-id: http://core.svn.wordpress.org/trunk@64152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Related: #15000
This PR replaces the
registered_datefield ofcore/users-querywith aregisteredobject, like thecore/content-querydate fields:registeredreturns{ site, gmt }: the registration date in the site's timezone and in GMT. Each is null when the stored date is not a valid date.fieldsinput acceptsregistered.siteandregistered.gmtto select a single date.Trac ticket: https://core.trac.wordpress.org/ticket/64657
Testing
Verify unit tests are passing:
Or run the ability in the editor console:
Each item should have a
registeredobject withsiteandgmtkeys.AI disclosure: the change and tests were drafted with AI assistance (Claude Code) and reviewed by me.