Skip to content

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

Merged
schlessera merged 4 commits intowp-cli:masterfrom
JanVoracek:skip-email
Jul 13, 2018
Merged

Optional --skip-email flag for wp user update#155
schlessera merged 4 commits intowp-cli:masterfrom
JanVoracek:skip-email

Conversation

@JanVoracek
Copy link
Copy Markdown
Contributor

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
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
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.

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

$user_ids[] = $user->ID;
}

if ( isset( $assoc_args['skip-email'] ) ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@danielbachhuber danielbachhuber added command:user Related to 'user' command command:user-update Related to 'user update' command labels Mar 18, 2018
@danielbachhuber
Copy link
Copy Markdown
Member

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

@JanVoracek
Copy link
Copy Markdown
Contributor Author

Yes, I will fix it. Sorry for waiting.

@schlessera
Copy link
Copy Markdown
Member

@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
@schlessera schlessera dismissed danielbachhuber’s stale review July 13, 2018 12:20

All points covered.

@schlessera schlessera merged commit 7b00064 into wp-cli:master Jul 13, 2018
@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
Copy link
Copy Markdown
Member

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

Labels

command:user Related to 'user' command command:user-update Related to 'user update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants