If you do a lot of WordPress development work, you’re bound to receive WordPress database sometimes that you don’t have an admin account for. We usually test, if possible, on a database the client provides us with. We used to have to go into the database and change an existing user, or add a new one by hand, and well, that wasn’t too optimal.
Quite a while ago I came across a script (mentioned before in a WordPress Scripts post) called emergency.php that partly solved this issue for us, but it was not really what we’d call the answer to all our problems. It sent out an email to the admin saying the password for the admin was changed, something we actually didn’t want to happen, because we couldn’t change the email in the same script. It also didn’t allow us to add a new user, and didn’t have any security restrictions, so leaving it out in the open was quite a horrific experience.
This morning, when I ran into this issue for the gazillionth time, I decided it was time to fix it. So I built a new user manager script, still dubbed emergency.php because basically that’s when you use it. It looks like this:
As you can see it asks for the database password. If you have FTP access, that’s easy enough to come by, but it prevents other people from messing up your site when you accidentally leave the file online. Once you’ve selected a user or chosen to add a new one, and you’ve entered the correct database password, you’ll get a screen like this:
Clicking “Add user” will add the user to the database, or, if you’re editing an existing user, update it in the database. Easy does it! You can download the file here, enjoy!
Update June 29th 2010: We’ve patched several issues within the file, fixing the empty roles dropdown, not being able to include the required files and some notices. Download the latest version here, links above have been updated too.