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

Update examples in user commands #467

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/User_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* # Delete user 123 and reassign posts to user 567
* $ wp user delete 123 --reassign=567
* Success: Removed user 123 from http://example.com
* Success: Removed user 123 from http://example.com.
*
* @package wp-cli
*/
Expand Down Expand Up @@ -262,12 +262,12 @@ public function get( $args, $assoc_args ) {
*
* # Delete user 123 and reassign posts to user 567
* $ wp user delete 123 --reassign=567
* Success: Removed user 123 from http://example.com
* Success: Removed user 123 from http://example.com.
*
* # Delete all contributors and reassign their posts to user 2
* $ wp user delete $(wp user list --role=contributor --field=ID) --reassign=2
* Success: Removed user 813 from http://example.com
* Success: Removed user 578 from http://example.com
* Success: Removed user 813 from http://example.com.
* Success: Removed user 578 from http://example.com.
*
* # Delete all contributors in batches of 100 (avoid error: argument list too long: wp)
* $ wp user delete $(wp user list --role=contributor --field=ID | head -n 100)
Expand Down Expand Up @@ -979,9 +979,9 @@ public function list_caps( $args, $assoc_args ) {
*
* # Import users from local CSV file
* $ wp user import-csv /path/to/users.csv
* Success: bobjones created
* Success: newuser1 created
* Success: existinguser created
* Success: bobjones created.
* Success: newuser1 created.
* Success: existinguser created.
*
* # Import users from remote CSV file
* $ wp user import-csv http://example.com/users.csv
Expand Down Expand Up @@ -1178,20 +1178,26 @@ public function import_csv( $args, $assoc_args ) {
* Reset password for editor.
* Success: Passwords reset for 2 users.
*
* # Reset and display the password.
* $ wp user reset-password editor --show-password
* Reset password for editor.
* Password: N6hAau0fXZMN#rLCIirdEGOh
* Success: Password reset for 1 user.
*
* # Reset the password for one user, displaying only the new password, and not sending the change email.
* $ wp user reset-password admin --skip-email --porcelain
* yV6BP*!d70wg
*
* # Reset password for all users.
* $ wp user reset-password $(wp user list --format=ids)
* Reset password for admin
* Reset password for editor
* Reset password for subscriber
* Reset password for admin.
* Reset password for editor.
* Reset password for subscriber.
* Success: Passwords reset for 3 users.
*
* # Reset password for all users with a particular role.
* $ wp user reset-password $(wp user list --format=ids --role=administrator)
* Reset password for admin
* Reset password for admin.
* Success: Password reset for 1 user.
*
* @subcommand reset-password
Expand Down Expand Up @@ -1287,7 +1293,7 @@ public static function wp_new_user_notification( $user_id, $password ) {
*
* $ wp user spam 123
* User 123 marked as spam.
* Success: Spamed 1 of 1 users.
* Success: Spammed 1 of 1 users.
*/
public function spam( $args ) {
$this->update_msuser_status( $args, 'spam', '1' );
Expand Down
Loading