Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.2   Updated Thursday, February 19th, 2009 at 7:19pm

Import Users Plugin for WordPress

This plugin was created for people who need to easily add multiple users to their WordPress installation. Simply give it a list of usernames and email addresses, specify the role of the users (subscriber, author, admin, etc.) and it does the rest. It will automatically email each user and give them their randomly generated password, or let you specify one. It also has validation in place to make sure the usernames do not already exist, that the email addresses are not already in use, that the usernames are valid, etc. After it processes the information, it tells you how many were added, and upon error, gives you the reason why each failed.

Download

  If you have found this page useful, please consider donating. Thanks!

Changelog

  • 02-19-09 Version 1.2 – Updated modified version with contributions by Robert McKenzie (Thanks Robert!). Changes include the ability to specify a password, as well as first/last names.
  • 06-12-07 – Modified version by Nicholas LaRacuente added (download link above).
  • 05-03-07 Version 1.1 – Updated to take advantage of the customizable roles feature in WordPress 2.1. This update was contributed by Tom Ransom.
  • 08-06-06 Version 1.0 – First release.

Instructions

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory.
  • Enable the plugin.
  • Use it by going to ‘Settings -> DDImport Users’

Usage

The userdata is entered in the following format:

username|firstname|lastname|password|email|role
username|firstname|lastname|password|email|role
username|firstname|lastname|password|email|role
etc…

To clarify, that is one user per line, with a pipe character between the values. Extra whitespace and empty lines are trimmed automatically. Be sure your data is entered properly! If you do not want to assign a password, first name, or last name, just do not enter them. The field separators are still required. Example:

username||||user@domain.com|

After you have added your user data, you can choose the role for the users with the drop down box. The choices are: Subscriber (default), Contributor, Author, Editor, and Administrator.

If the password is not specified, one will be randomly generated. In either case, the password is emailed to the user.

Pages: « 7 6 5 4 3 [2] 1 » Show All

  1. Happy to provide a improvement -
    With 2.1, the names of the roles can change (and be added) – so rather than hard code the role names on the import screen, I have modified the code to request the list of available roles for the select at the bottom of the page.

    on line 28, add $wp_roles to the global
    global $wpdb, $wp_roles;

    at line 228, replace the hard-coded list of roles with

    
    		<?php
    			if ( !isset($wp_roles) ) 
    				$wp_roles = new WP_Roles();
    			foreach ($wp_roles->get_names() as $role=>$roleName) {
    			echo '<option value="'.$role.'">'.$roleName.'</option>';
    			}
    		?>
    

  2. Redownloading worked. No plugin conflicts (default setup for a testing site). Weird, but thanks!

  3. Kim: Not right at all :) Did you already try re-downloading the plugin file? If that did not help, maybe there is some sort of a conflict with another plugin?

  4. I saved the file as directed and uploaded it to my plugins folder. When I log in to the admin area and go to plugin management, I get the entire plugin code spread around the plugin admin table. I’m not sure what’s going on, but I know something’s not right.

    I’m using WP 2.1.2

  5. Ramon: Do you use WordPress 2.0 or newer?

  6. Im getting this error just when i click on “Import Users”:

    Fatal error: Call to undefined function: validate_username() in /home/labfis/public_html/blog/wp-content/plugins/dd-import-users.php on line 96

  7. Hei! I find the problem now: I use the Themed Login Plugin (http://www.jameskelly.org/wordpress-plugins/custom-login-and-registration-forms-plugin/) but it was not config. There was the wrong e-mail in.

    I´m sorry!
    Markus

  8. Markus: I am not sure about that one, since this particular plugin uses the functions built into WordPress to notify the users of the new account – it does not send the mail itself. There is surely a way, I have just not experimented with it. Is that the address you have setup under the admin account?

  9. Hei!

    How can i chance the sender-email-adress? the plugin use wordpress@gmail.com, but i will use another.

    Thank´s a lot!
    Markus

  10. andrabr: Good suggestions – thanks :)

  11. 20
    andrabr

    Works like a charm!

    I would suggest for the next version an option to choose the delimiter and maybe even to upload a file: a comma would allow people to import from excel, and a space delimiter would allow for basic copy/paste… Many a php virgin will thank you for that.

  12. Thomas Burg: This plugin actually uses the same functions WordPress uses when a new user registers. Which means the sender’s email address, and message are not defined in this plugin – they are set in the WP core files. They can most likely still be set, just not through the plugin itself. It calls the wp_new_user_notification function. Here is some info on where that function is defined, and where it is referenced: http://wordpress.taragana.net/_functions/wp_new_user_notification.html

  13. Hi, thanks for that great script!
    Thereare just two thinga:
    - how gets the senders email choosen? In my case it uses an non-existing email which is a problem in case of replies and I don#t know where to change that.
    - I’d like to edit the text that gets send.

    Appreciate your help.

    Thanks
    Thomas

  14. Thanks for all your help I’m using the Email Notification plug-in and it seems to handle the load well.

  15. Chris: There may be some info on the max number of WordPress users in the WordPress forum – I am not sure. And no, I have not used that plugin :)

Pages: « 7 6 5 4 3 [2] 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.