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

Optional `--skip-email` flag for `wp user update` #155

Merged
merged 4 commits into from Jul 13, 2018

Conversation

3 participants
@JanVoracek
Copy link
Contributor

JanVoracek commented Mar 16, 2018

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-email and they are missing as well.

@danielbachhuber

This comment has been minimized.

Copy link
Member

danielbachhuber commented Mar 18, 2018

I would write some tests but I'm not really sure how to test it.

Here's an example:

And an email should be sent

@danielbachhuber
Copy link
Member

danielbachhuber left a comment

It'd be great to have tests on this too, thanks.

@@ -498,6 +501,11 @@ public function update( $args, $assoc_args ) {
$user_ids[] = $user->ID;
}
if ( isset( $assoc_args['skip-email'] ) ) {

This comment has been minimized.

@danielbachhuber

danielbachhuber Mar 18, 2018

Member

This should use WP_CLI\Utils\get_flag_value()

@@ -498,6 +501,11 @@ public function update( $args, $assoc_args ) {
$user_ids[] = $user->ID;
}
if ( isset( $assoc_args['skip-email'] ) ) {
add_filter( 'send_email_change_email', '__return_false' );
add_filter( 'send_password_change_email', '__return_false' );

This comment has been minimized.

@danielbachhuber

danielbachhuber Mar 18, 2018

Member

Can we remove these filters after the fact, to ensure they don't bleed through to other commands?

@danielbachhuber

This comment has been minimized.

Copy link
Member

danielbachhuber commented Apr 10, 2018

@JanVoracek Still planning to come around and fix this up?

@JanVoracek

This comment has been minimized.

Copy link
Contributor Author

JanVoracek commented Apr 23, 2018

Yes, I will fix it. Sorry for waiting.

@schlessera

This comment has been minimized.

Copy link
Member

schlessera commented Jul 3, 2018

@JanVoracek Are you still up for working on this? Do you need any further help with something?

@schlessera schlessera added this to the 1.3.1 milestone Jul 13, 2018

All points covered.

@schlessera schlessera merged commit 7b00064 into wp-cli:master Jul 13, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@schlessera schlessera changed the title Optional --skip-email flag for 'wp user update' Optional `--skip-email` flag for `wp user update` Jul 13, 2018

@schlessera

This comment has been minimized.

Copy link
Member

schlessera commented Jul 13, 2018

Thanks for your work on this, @JanVoracek !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.