While working on a couple of WordPress projects for two sites I host (www.cambridgerepeaters.net & www.cambridgeshire-raynet.net) I had the need to do mass account creation.  These were 30+ accounts at a time, not a thrilling prospect to do that via the normal admin interface.  Searching the net was nearly useless, until I found a WP plugin called “Import Users Plugin for WordPress”.  This worked, but was very simple and didn’t suit my needs.

So, after looking at the script and figuring out how it worked (I’m not PHP coder but I can get by in a pinch), I managed to hack the script to do what I wanted.  The script as provided above only allows for the email address and login name, the 2 required bits of info to create a new account on a WP system.  However, I needed to be able to specify:

  • first name
  • last name
  • password

Another nice thing to have on the import is being able to set the WordPress user role (access level), so I shoved that in as well.  On the plugin page I posted a comment about my updates and a link to the new modified script:

I’d like to submit another modified version of this great script. The changes I’ve made to the script allows for adding first and last names, setting a password and setting the role for the imports. I’m also using the more powerful method of account creation, “wp_insert_user” this allows a lot more in the way of adding nice things to the script and new account.

The import file or manually entered format is:

username|firstname|lastname|password|email|role

All fields except username and email are optional, but all fields must be delimited, ie:

fred|Fred|Rivers|mypassw0rd|fred@rivers.com|Editor
sam|Sam||sam@mypress.com|

Fred has everything assigned while Sam will be emailed his generated password and his role will be set to whatever was selected from the drop down box on the form.

I’d be interested in any comments on my changes. There have been quite a few changes, I suggest a diff of mine and the latest modified one.

My modified version can be found at:

http://www.uk-experience.com/scripts/dd-import-users-mod_wp27.txt

I hope people find this useful, I think it’s a function that’s needed by far more people then you might expect.  In my mind, it’s something that should be part of the core code for WordPress.  I can see more modifications coming to this script as my projects progress.  While looking into changes for the script I’ve found other things that would be nice to have at the time of import too…

Watch this space…
Updated script

2009.06.17 @ 2013GMT

Version 1.1.13 – Added user URL to be imported into user details (not the default assigned blog for WPMU)

dd-import-users-mod_wp27_v1.1.13.txt

Note the new format when using this version:

The import file or manually entered format is:

username|firstname|lastname|password|email|role|URL

All fields except username and email are optional, but all fields must be delimited, ie:

fred|Fred|Rivers|mypassw0rd|fred@rivers.com|Editor|http://blah.com
sam|Sam||sam@mypress.com||

46 Responses to “WordPress Mass Account Import”
  1. Daniel says:

    I imported 500(subscribed) users from my old site and have had 55(registered subscribers) new users sign up but i want them all to be subscribed is there a plugin for this after the users are in?

    If i got into Tools>>Subscribers i can see that all the ones i imported are not subscribed. I can manually edit each one to Automatically subscribe me to newly created categories:. Can a plugin do all these to same tones of time?

    • kelly says:

      Daniel,
      Did you assign the role? If you matched the text string for the subscribed person in your new blog, it should have worked. If you left it blank, then the script couldn’t assign them as a subscriber. Also make sure you are using the latest version of the script. there are three updates listsed above.. you want the most recent one. The early version didn’t assign role.

      username|firstname|lastname|password|email|role|URL

      • Daniel says:

        Hi, sorry to say it wasn’t your plugin. I should have mentioned that. Mainly my question was related to how i could adjust where it’s currently at! If i try to do this from now what would you suggest?

  2. Trip says:

    Am i crazy or is this code behind a log in? I tried to follow the links, but hit a log in for grammary-tech.com and my google log in did not get me past.

    • rob says:

      Sorry about that, a recent change in my server configuration caused that problem. I’ve corrected the links now. Thanks for letting me know about that.

  3.