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
Merged
Diff settings

Always

Just for now

Copy path View file
@@ -481,6 +481,9 @@ public function create( $args, $assoc_args ) {
* --<field>=<value>
* : One or more fields to update. For accepted fields, see wp_update_user().
*
* [--skip-email]
* : Don't send an email notification to the user.
*
* ## EXAMPLES
*
* # Update user
@@ -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.

Copy link
@danielbachhuber

danielbachhuber Mar 18, 2018

Member

This should use WP_CLI\Utils\get_flag_value()

add_filter( 'send_email_change_email', '__return_false' );
add_filter( 'send_password_change_email', '__return_false' );

This comment has been minimized.

Copy link
@danielbachhuber

danielbachhuber Mar 18, 2018

Member

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

}
$assoc_args = wp_slash( $assoc_args );
parent::_update( $user_ids, $assoc_args, 'wp_update_user' );
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.