Working with WordPress users

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

7 comments on “Working with WordPress users
  1. joseLuís says:

    Hi! Good job, I’m eager to try it! but I can’t find the download link of new versión.

  2. [email protected] says:

    This is good news. It will be very helpful Glad to see WordShell in moving forward.

  3. [email protected] says:

    In the list users, will the list report the role? So we can see admin or editors etc.

  4. [email protected] says:

    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?

Leave a Reply