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

Use current_time() for setting the default value for user_registered in wp user create #378

Merged
merged 2 commits into from
Oct 3, 2022

Conversation

jorgeatorres
Copy link
Contributor

@jorgeatorres jorgeatorres commented Oct 1, 2022

This PR fixes issue #377, by relying on current_time() instead of date_format() to properly produce a default value for user_registered when creating users via wp user create.

I've also included a behat test that should fail in master (but not on this branch).

Note: I did a quick search through the org and this seems to be the only place where we were using date_format() with an invalid format.

Steps to test

  1. Check out master.
  2. Run wp user create testuser [email protected].
  3. Check that wp user get testuser shows 0000-00-00 00:00:00 as the value for the user_registered field.
  4. Delete the user created in step 2. For example, with wp user delete testuser.
  5. Check out this branch.
  6. Repeat step 2 and confirm that this time the current date/time is the value of the user_registered field.

Closes #377.

Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @jorgeatorres ! I appreciate your detailed description 😊

@danielbachhuber danielbachhuber added this to the 2.3.3 milestone Oct 3, 2022
@danielbachhuber danielbachhuber merged commit f1bc9cc into wp-cli:master Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wp user create with no --user_registered arg creates users with invalid registration date
2 participants