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

Add commands for managing signups on multisite #489

Merged
merged 17 commits into from
May 4, 2024

Conversation

ernilambar
Copy link
Member

@ernilambar ernilambar commented Mar 15, 2024

Adds signup command and subcommands

  • signup list
  • signup activate
  • signup get
  • signup delete

Command details: https://github.com/ernilambar/entity-command/tree/feat-signup#wp-signup

Related: wp-cli/wp-cli#1911

PR inspired from https://github.com/trepmal/wp-cli-unconfirmed-users

Highlights:

  • Separate Signup Fetcher is used here
  • Better signup validation using $this->fetcher->get_check()
  • Command class extends CommandWithDBObject which provides several helpful methods
@ernilambar ernilambar force-pushed the feat-signup branch 5 times, most recently from bd08560 to 687509b Compare March 15, 2024 10:31
@ernilambar ernilambar marked this pull request as ready for review March 15, 2024 10:44
@ernilambar ernilambar requested a review from a team as a code owner March 15, 2024 10:44
Copy link
Contributor

@tyrann0us tyrann0us left a comment

Choose a reason for hiding this comment

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

Thank you very much for working on this! I left some nit-picky comments that try aligning wording as close to existing commands as possible.
If you agree with my comments in README.md, please also apply them to src/Signup_Command.php. Thank you!
Also, I would have expected that there would be WordPress APIs (PHP functions) for fetching and deleting signups, but I couldn't find anything. 🤷🏽

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/Signup_Command.php Outdated Show resolved Hide resolved
src/Signup_Command.php Show resolved Hide resolved
src/Signup_Command.php Outdated Show resolved Hide resolved
src/Signup_Command.php Outdated Show resolved Hide resolved
src/WP_CLI/Fetchers/Signup.php Outdated Show resolved Hide resolved
@ernilambar
Copy link
Member Author

Note:

Copy link
Contributor

@tyrann0us tyrann0us left a comment

Choose a reason for hiding this comment

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

Thanks for incorporating all the changes. 🙏🏽
Would it be possible to add tests for failed activating and deleting signups to ensure the presence of the "Failed (activating|deleting) signup 123" message?

Fetcher should be probably moved to https://github.com/wp-cli/wp-cli/tree/main/php/WP_CLI/Fetchers

Does it make sense to create a separate PR there, have it merged, and then continue here?

README.md Outdated Show resolved Hide resolved
src/Signup_Command.php Show resolved Hide resolved
Copy link
Contributor

@tyrann0us tyrann0us left a comment

Choose a reason for hiding this comment

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

I left another round of nit-picky wording-related comments. However, these don't stop me from approving.
Thank you for working on this! It's a small feature, but we have desperately wanted it at times. 💚

src/Signup_Command.php Outdated Show resolved Hide resolved
src/Signup_Command.php Outdated Show resolved Hide resolved
src/Signup_Command.php Show resolved Hide resolved
src/Signup_Command.php Show resolved Hide resolved
@tyrann0us
Copy link
Contributor

Hi @danielbachhuber, to continue our conversation from wp-cli/wp-cli#1911, would you consider this PR ready? Thanks!

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.

Great start! I left some comments.

src/WP_CLI/Fetchers/Signup.php Outdated Show resolved Hide resolved
entity-command.php Outdated Show resolved Hide resolved
features/signup.feature Show resolved Hide resolved
@swissspidy
Copy link
Member

@ernilambar I just merged wp-cli/wp-cli#5926 now

To make the PR work now, update composer.json here to require "wp-cli/wp-cli": "^2.11"

@swissspidy
Copy link
Member

I don't understand the test failures, they look unrelated 🤔

@ernilambar
Copy link
Member Author

I don't understand the test failures, they look unrelated 🤔

Yah, there are no changes related to taxonomies here.

@swissspidy
Copy link
Member

swissspidy commented Apr 26, 2024

Ah, when I try locally I get this:

$ WP_VERSION=trunk composer behat features/taxonomy.feature:7
> run-behat-tests 'features/taxonomy.feature:7'
-----

--- Failed hooks:

    BeforeSuite # WP_CLI\Tests\Context\FeatureContext::prepare()
      $ wp cli info
      
      Error: Callable "Signup_Command" does not exist, and cannot be registered as `wp user signup`.
      cwd: 
      run time: 0.16830706596375
      exit status: 1 (RuntimeException)

Edit: just needed to run composer update

@swissspidy
Copy link
Member

wp-cli/wp-cli#5928 has been reverted in the meantime

@johnbillion
Copy link
Contributor

See also wp-cli/ideas#99

src/Signup_Command.php Outdated Show resolved Hide resolved
src/Signup_Command.php Outdated Show resolved Hide resolved
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.

@ernilambar Can you:

  1. Credit the original package in the PR description?
  2. Highlight any differences between this implementation and the original package?
src/Signup_Command.php Show resolved Hide resolved
src/Signup_Command.php Show resolved Hide resolved
@danielbachhuber danielbachhuber changed the title Add signup command class Apr 27, 2024
@swissspidy swissspidy merged commit 3648d0e into wp-cli:main May 4, 2024
38 checks passed
@swissspidy swissspidy added this to the 2.8.0 milestone May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment