Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLMS post date properties (and WP 5.3): make them nullable and account for date_floating property #131

Open
eri-trabiccolo opened this issue Oct 29, 2019 · 0 comments
Labels
Type: Enhancement Improvements existing features or code Type: Question This issue is a question

Comments

@eri-trabiccolo
Copy link
Contributor

eri-trabiccolo commented Oct 29, 2019

In WP 5.3 there will be some changes that will impact on the wp posts date properties.
They will impact the rest-api as well as you can see in the following two commits:
(null dates) WordPress/WordPress@b15c0d4#diff-2bdd57a49dbaa7ba0108f91132d37216
(floating date)
WordPress/WordPress@ef86b03#diff-2bdd57a49dbaa7ba0108f91132d37216

Interesting the possibility of specifying the property type as an array:
WordPress/WordPress@b15c0d4#diff-337a27824fef93e1a776fe4a26fff320R1904

which anyways requires the wp core functions rest_sanitize_value_from_schema and rest_validate_value_from_schema
WordPress/WordPress@b15c0d4#diff-04b011c39a32e2b17ffb640e03cd3d01R1211
WordPress/WordPress@b15c0d4#diff-04b011c39a32e2b17ffb640e03cd3d01R1390

I think we can - but didn't test it - create our own wrappers for these two functions (which actually means make also wrappers for rest_sanitize_request_arg and rest_validate_request_arg) to handle the backward compatibility with older wp versions and then make these:
https://github.com/gocodebox/lifterlms-rest/blob/1.0.0-beta.8/includes/abstracts/class-llms-rest-posts-controller.php#L1008-L1017
something like:

				'date_created'     => array(
					'description' => __( 'Creation date. Format: Y-m-d H:i:s', 'lifterlms' ),
					'type'        => array( 'string', 'null' ),
					'context'     => array( 'view', 'edit' ),
					'arg_options' => array(
						'sanitize_callback' => 'llms_rest_sanitize_request_arg',
						'validate_callback' => 'llms_rest_validate_request_arg'
					),
				),
				'date_created_gmt' => array(
					'description' => __( 'Creation date (in GMT). Format: Y-m-d H:i:s', 'lifterlms' ),
					'type'        => array( 'string', 'null' ),
					'context'     => array( 'view', 'edit' ),
					'arg_options' => array(
						'sanitize_callback' => 'llms_rest_sanitize_request_arg',
						'validate_callback' => 'llms_rest_validate_request_arg'
					),
				),

(and of course we can create our wrapper for has_param() too).

@eri-trabiccolo eri-trabiccolo added hacktoberfest PRs for this issue count towards Hacktoberfest contributions! Type: Enhancement Improvements existing features or code language: php good first issue If you're a first time contributor this is a good issue for you! help wanted Looking for contributors to assist with this issue Type: Question This issue is a question and removed good first issue If you're a first time contributor this is a good issue for you! hacktoberfest PRs for this issue count towards Hacktoberfest contributions! help wanted Looking for contributors to assist with this issue labels Oct 29, 2019
@thomasplevy thomasplevy moved this to Awaiting Triage in Development Apr 21, 2022
@thomasplevy thomasplevy moved this from Awaiting Triage to Backlog in Development Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improvements existing features or code Type: Question This issue is a question
Projects
Status: Backlog
Development

No branches or pull requests

2 participants