Optional --skip-email flag for wp user update#155
Merged
schlessera merged 4 commits intowp-cli:masterfrom Jul 13, 2018
JanVoracek:skip-email
Merged
Optional --skip-email flag for wp user update#155schlessera merged 4 commits intowp-cli:masterfrom JanVoracek:skip-email
--skip-email flag for wp user update#155schlessera merged 4 commits intowp-cli:masterfrom
JanVoracek:skip-email
Conversation
Member
Here's an example: |
danielbachhuber
previously requested changes
Mar 18, 2018
Member
danielbachhuber
left a comment
There was a problem hiding this comment.
It'd be great to have tests on this too, thanks.
src/User_Command.php
Outdated
| $user_ids[] = $user->ID; | ||
| } | ||
|
|
||
| if ( isset( $assoc_args['skip-email'] ) ) { |
Member
There was a problem hiding this comment.
This should use WP_CLI\Utils\get_flag_value()
|
|
||
| if ( isset( $assoc_args['skip-email'] ) ) { | ||
| add_filter( 'send_email_change_email', '__return_false' ); | ||
| add_filter( 'send_password_change_email', '__return_false' ); |
Member
There was a problem hiding this comment.
Can we remove these filters after the fact, to ensure they don't bleed through to other commands?
Member
|
@JanVoracek Still planning to come around and fix this up? |
Contributor
Author
|
Yes, I will fix it. Sorry for waiting. |
Member
|
@JanVoracek Are you still up for working on this? Do you need any further help with something? |
schlessera
approved these changes
Jul 13, 2018
--skip-email flag for wp user update
Member
|
Thanks for your work on this, @JanVoracek ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes (e.g. in our use case) it might be handy to update the user's details without bothering him with an email.
I would write some tests but I'm not really sure how to test it. I was looking for tests of
wp core install --skip-emailand they are missing as well.