WordShell presently supports three basic operations for working with WordPress users; list, add, and delete. With each, the –users switch is used.
List users (–user –list)
This support is presently very simple; it just lists all the logins available on your site. You can of course use standard POSIX tools like grep to filter the output.
wordshell mysite --user --list
Add –detailed to get more information on the users (currently: login, email address, role).
Add a user (–user –add)
Use this to add a user to your WordPress site. Especially useful for getting yourself a quick admin login. The –email parameter is required, and –role is optional. A password will be generated for the user and output on the screen.
wordshell mysite bob --user --add [email protected] --role=editor
Delete a user (–user –delete)
Use this to delete a user. You can specify the user by login, or by email address.
All the user’s posts/comments/etc. will be deleted, unless you use the optional –reassign parameter, which also can take either a login or email address. Alternatively, if you supply the value ‘@admin’, then the posts will be assigned to the site’s first (i.e. lowest ID) admin.
# Delete bob and all his content
wordshell mysite bob --user --delete
# Delete bob from every site and re-assign his content to the first admin (useful for when a staff member leaves)
wordshell mysite bob --user --delete [email protected]
If in any case a specified user cannot be found, then the command will return an error without doing anything.
Reset a user’s password (–user –passwordreset)
Use this to reset a user’s password. It will set a random password for the user.
# Reset password for bob on a single site
wordshell mysite bob --user --passwordreset