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.gammaray-tech.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||

38 Responses to “WordPress Mass Account Import”
  1. Terry Moore says:

    This script is exactly what I was looking for and needed. Thanks.

  2. Francois says:

    Hello !
    Do you can hack this script also for “AutorDescription” ? It was very fantastic !
    Thank you !

  3. Francois says:

    ok. It’s done with AutorDescription (sorry for my very bad english)
    Here : http://rapidechange.com/d/96707/2pMaYsZQ/dd-import-users-mod_wp27_v1.1.14.rar

    Usage :

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

  4. Daniel Noll says:

    Users are being added successfully, but the password is auto-generated in each case…instead of the password I’ve specified.

    Any idea why this would be happening?

    I love the concept of this plugin and would like to use it to save a day’s worth of manual user input.

  5. Daniel Noll says:

    I discovered what the issue was…all sorts of odd behavior (auto-generated passwords, some records not loading) due to the Register Plus plugin.

  6. Thanks for making this available! It was exactly what I needed to import more than 1500 users from our old website into our MU setup.

    Thank you!

  7. Matt says:

    Wordpress 2.8.4, still nothing…pasted in the data, but just switches back to Tools screen. Nothing imports…argh

  8. onetrick says:

    Hello,
    I am trying to import 11,000 users from one wordpress installation to another. Your script and guide looks very promising however… what good is importing when I can not figure out how to export user data?!

    I’d like to have their username|email|password carried over at least. Everything would be better. I would appreciate it very much if you could help me a little bit with this one.

    Thank you!

  9. Kenny says:

    Thanks for the plug-in and it works so well for hundreds of ppl, but is there any way to stop acknowledging the user automatically? Since I would send email all new users with some other messages with an attachment like user guide :)
    Thansk again!

  10. Robert says:

    Kenny,

    Sorry, sending of the email is something that wordpress does itself. It’s been a while since I’ve even looked at the script I can’t recall off hand if there is a way to prevent it.

  11. Claire says:

    As Onetrick said, how can we actually export our WP users in the right format for the import to WPMU?

  12. Rob says:

    I’m curious, is there a way to import the usernames without sending them the users emails? Thanks.

  13. Curtis Penner says:

    Hi Rob,

    Great plugin. It’s going to save loads of work. I have a question for you…

    If I wanted to eliminate the two name fields (first and last) and just make one field – “Name”, how would I make the modifications?

    Would I just delete all instances of “last name” and change “first name” to “name”?

  14. Hello Curtis,

    You really can’t, these are stored in the database as separate items.. you could put both names into one field and just put an extra “|” in to represent the last name .. ie:

    fred|Fred Rivers||mypassw0rd|fred@rivers.com|Editor

    That would give you want you want, sort of but it users first name would be “Fred Rivers” whilst not having a last name.

  15. Curtis Penner says:

    Thanks for the quick reply Robert.

    Just so I’m clear…

    I have an excel spreadsheet with one column labeled as Name. Let’s say I have “Curtis Penner”.

    I could use the column labeled “Name” as “firstname” and leave the “lastname” field blank?

    So it would look like…

    Curtis Penner||mypassword|myemail|myrole

    I just want to clarify because your example has “fred|Fred Rivers|…and I wasn’t sure why “fred” would be there.

  16. Curtis,

    You are sort of correct .. you must remember the very first field is the login name .. so you really should split your users “Name” into first and last names.. you might find this page helpful in doing that in Excel ..

    http://office.microsoft.com/en-us/excel/HA011498511033.aspx

    Remember, the line to import must look like:

    login_name|Curtis Penner||mypassword|myemail|myrole

  17. David says:

    Awesome. I’ve been looking for something like this for a bit. In my case, I’m trying to keep a wordpress user base in sync with a third-party application. On a weekly basis, I’ll update the wordpress users. Is there any way to tell the script to compare the table and the csv file and make the table match the csv file, deleting users that aren’t in the csv file but in the table, adding users that are in the file but not the table, and ignoring those that are in both? It sounds ridiculous, but we have a very transient user-base at this org, having over 1000 employees and experiencing over 100% turnover per year.

    Thanks, again.

  18.  
Leave a Reply