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.
e.g.
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.
e.g.
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.
e.g.
# 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]
# Delete a user by email address, and re-assign all content to a user with a different email address
wordshell mysite [email protected]
--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.
e.g.
# Reset password for bob on a single site
wordshell mysite bob --user --passwordreset
# Reset password on every site where the user has email address [email protected]
wordshell mysite [email protected]
--user --passwordreset
- Previous chapter: Working with WordPress core
- Next chapter: Working with the WordPress database
Hi! Good job, I’m eager to try it! but I can’t find the download link of new versión.
Not yet released!
This is good news. It will be very helpful Glad to see WordShell in moving forward.
In the list users, will the list report the role? So we can see admin or editors etc.
It does now. 🙂
I manage several servers each of which hosts multiple WP sites (around 100 total). I have an admin login on each one of those sites and I was thinking it might be nice to change my password once in a while. I hate the thought of having to log into every site and change it. Any possibility of being able use this utility? I know…probably not the best idea to have the same password on every site. Next question would be can I use some sort of pattern such as the first three letters of the domain plus my chosen password or something like that?
Hi,
It’s a good day for you today… we programmed this feature last week. We’ve just updated the current release and the manual page so that you can get it. Currently it doesn’t allow you to specify the password; it sets a random password for you.
e.g. to reset every user with email address [email protected] :
wordshell all [email protected] –user –passwordreset
Best wishes,
David