1. Home
  2. Knowledge Base
  3. Uncanny LearnDash Toolkit Pro
  4. Import Users

Overview

The Import LearnDash User module is part of the Pro Suite of modules for the Uncanny LearnDash Toolkit. This module lets you not only create new users in bulk but also add them to courses and LearnDash Groups, all from a CSV file. You can update existing users via CSV import too. Your users can be notified when their account is created or updated. This is a huge time-saving feature for those who need to manage a large number of users on their LearnDash site manually.

This is a complex module and we recommend starting by watching the YouTube video above in its entirety.

Here are some case scenarios when you might consider importing users from CSV:

  • Your site does not allow self-registration. You need to manually create a batch of new users at a time.
  • You create generic user accounts and recycle them. You need to reset user passwords before each new cycle.
  • You sell access to organizations. You need to set up a new LearnDash Group for each organization and quickly add their users to this new group.
  • You introduced a new course. A company bought access for their staff but they’re not all in groups. You need to add their users to this new course quickly.

Importing users involves a four-step process. It’s important that you review the instructions and download our sample CSV to see examples of the fields that can be included. We also recommend that you test your import with a small number of users first.

Step 1: Review Options

Use the Options tab to configure:

  1. Whether to update or ignore users that already exist on your website
  2. Role to assign to imported users
  3. Course(s) to enroll imported users into
  4. LearnDash Group(s) to assign imported users to

Step 2: Review Email Settings

Use the Email Settings tab to:

  • Enable email notifications to new and/or updated users
  • Customize email templates

Here is an example of an email template with variables which will be replaced with specific account and site information when the email is sent to users.

pro_import_user_email_template

 

Note: If you enable Send Email but do not provide content for the subject or message, the default email template will be used. Also note that the message can contain HTML, and because it supports HTML your emails will not use an email template plugin (like WP Better Emails) if one is installed. To brand your emails consider pasting the email template HTML source into the Text view of the email editor.

Step 3: Create a CSV file

Your CSV file must be comma-delimited with a .csv extension. It requires user_login and user_email columns, and can include any number of optional meta fields below.

Column HeadingDescriptionRequired/Optional
user_loginThe user's usernameRequired
user_emailThe user's emailRequired
user_passThe user's passwordOptional
first_nameThe user's first nameOptional
last_nameThe user's last nameOptional
display_nameThe user's display nameOptional
wp_roleRole to assign to the imported user, specified by role slug. If this column exists and cell is empty, the role in Options will be used. Available role slugs for your site are listed in the Available Meta Fields table in the Instructions tab.Optional
learndash_coursesOne or more courses to enroll the user into, specified by course ID. If this column exists and cell is empty, course(s) in Options will be used. Multiple course IDs must be separated by semi-colons, e.g., 96;107;92Optional
learndash_groupsOne or more LearnDash groups to enroll the user into, specified by group ID. If this column exists and cell is empty, group(s) in Options will be used. Multiple group IDs must be separated by semi-colons, e.g., 91;102;98Optional

Notes:

  • Use the column heading learndash_courses to enroll users in specific courses.  For enrollment in multiple courses, separate course IDs with semicolons (;). If this column is blank or omitted from the spreadsheet altogether, users are enrolled in the courses specified in import options (Step 1 above).
  • Use the column heading learndash_groups to assign users to specific groups. For assignment to multiple groups, separate group IDs with semicolons (;).  If this column is blank or omitted from the spreadsheet altogether, users are assigned to the groups specified in import options (Step 1 above).
  • If you don’t include a wp_role column in your CSV, all imported users will get the subscriber role.
  • If no user_pass column or value is present for new users, a password will be auto-generated.
  • Any other column heading not recognized as a standard WordPress meta key will be created as a custom user meta key.
  • Username and email address cannot be updated via import.
  • Although you may specify any role to assign to imported users, keep in mind certain roles (e.g., Group Leader) require additional setup. We recommend that you use import for learners (subscribers) only.

Let’s take a look at an example in which the same CSV file is used to create new users and update existing users (if Update is selected in Options). The CSV file contains the following data:

user_login,user_email,user_pass,first_name,last_name,wp_role,learndash_courses,learndash_groups
amiller,amiller@mymail.com,test1234,Anne,Miller,,,
ajones,ajones@mymail.com,,Arthur,Jones,,,
aryans,aryans@mymail.com,,Annie,Ryans,,11;22,100;200

Suppose the first user, Anne Miller, is a new user. Her new account will be created with a manual password and the default role, course(s), and group(s) specified in Options.

Suppose the second user, Arthur Jones, is also a new user. Because the user_pass field is empty, his password will be auto-generated. He will be added to the default role, course(s), and group(s) specified in Options.

Suppose the third user, Annie Ryans, is an existing user. She will be enrolled into courses with IDs 11 and 22 as well as assigned the groups with IDs 100 and 200. There will be no change to her password.

Note that when you update existing users:

  • If you leave their first name and/or last name empty, the user’s existing meta value will be replaced with the blank value.
  • The course(s) and group(s) you specify in the CSV will be added to what’s already in the user’s profile rather than replacing them.

Step 4: Import Users

Go to the Import Users tab once your CSV file is ready to begin the import.

The Current Settings section shows you what has been configured in Options and Email Settings. Review these settings and make any changes as necessary.

import_users

When you are ready, proceed to the Import LearnDash Users section to upload your CSV file.

import_learndash_users

The validation results will show you any potential problems with the import. (The example below shows that one of the users has a malformed email address.)

importusers_validationresults

Make any necessary corrections to your CSV file and re-upload it, or click on Perform Import to proceed with import.

importusers_performimport

When import is complete, the page will refresh and confirm the number of users that have been successfully created/updated. Please note the first validation is a quick check. It may not always coincide with the final upload results which may report other conflicts such as mismatched usernames and email addresses.

Important: Are you an Uncanny LearnDash Groups user? If you are, uploads to a group with a defined seat limit will change the seat count when users are added to the group. If the group contains available seats, uploaded users will count against those seats. If the group has no available seats, the total seat count will be increased to accommodate the number of users imported so that 0 seats remain. Users exceeding the seat count will still be registered.

Tips

Version 2.0.5 of the plugin and later support customization of the import process to allow more flexibility in setting values like Display Name (which cannot be upload as a column). Here’s an example of a code snippet that could be used in a functions.php file to set Display Name equal to First Name and Last Name as part of the import:

add_filter('csv_wp_insert_user', 'uo_kb_insert_filter', 10, 2);
function uo_kb_insert_filter( $userdata, $current_row ){

   // $user_data give you an array of fields that can be a passed into the wp_insert_user function
   /*
    * ex.
    *
   $userdata = array(
       'user_email'  =>  'aflinch@example.com',
       'user_login'  =>  'aflinch',
       'user_pass'   =>  '4rV4Z1lQ9Jeg'
   );
    */

   // Add dsiplay name to user data as the first_name and last_name in the CSV row
   // ex. ["aflinch","aflinch@example.com","Adrian","Flinch","4rV4Z1lQ9Jeg","subscriber"]
   //         0              1                2         3          4             5
   // You will have to find out the index of the CSV cell
   $userdata['display_name'] = $current_row[2] . ' ' . $current_row[3];

   return $userdata;
}

 

Was this article helpful?

22 replies
    • Ryan
      Ryan says:

      Hi Manny,

      Our Groups plugin has a very limited version of the CSV user upload function, but I’m afraid this particular module is restricted to admins only. In the hands of Group Leaders it would be very dangerous and confusing, unless we modified it heavily to only support groups and courses associated with the Group Leader’s access. Even then, we would probably need to restrict email capabilities.

      We know there is value in adding more options like this for Group Leaders, like some level of customization for welcome emails, but I’m afraid that for now this remains an admin only module.

      Reply
      • Anfield
        Anfield says:

        Hi Ryan,
        We have a multisite WP and our site level admin cannot view the import user page. How to I let our site level admin to do the importing task? Thanks.

        Reply
        • Ken Young
          Ken Young says:

          Unfortunately, it looks like the Import LearnDash Users module is currently incompatible with multisite installations. We’re looking into whether we can add support in the next release. I’ll update here when we’re able to make that determination.

          Reply
    • Ken Young
      Ken Young says:

      To force the user reset their password, you can remove the %Password% token from the email and instead instruct them to follow a link to the password reset page on your site.

      Reply
  1. Ariel
    Ariel says:

    can you automatically set users to ‘completed’ status when importing? For example if you are moving to learndash from a different platform and want your users who have already completed the course to also have access to the new LD course but don’t want them to have to go through and complete all modules again. thanks!

    Reply
    • Ken Young
      Ken Young says:

      You can get the group ID by going to LearnDash LMS > Groups, clicking on a group, then looking at the URL in your browser. It should contain something like “?post=2011”. That number is the Group ID.

      Reply
  2. petest
    petest says:

    Hi,

    I downloaded the sample csv.
    Then i put text to columns, make some changes and save as csv.
    i get an error when oploading that i do not have the required email field.
    Thats because my csv is not seperated with , but with ;
    How can i change this setting?
    Because in your video you can upload the file with the csv set to columns.
    I do not want my client to do al lot of unnecesary steps of find and replacing all ; with , and then paste in the first column.

    Kind regards.

    Reply
    • Ryan
      Ryan says:

      This issue, where the delimiter is something other than a comma, is usually caused by the language settings on your computer and you use Excel to create the file. Changing your language settings is one option, or you might try importing the file into Google Sheets instead where it’s easier to export using a commas as the delimiter.

      Reply
  3. Dan
    Dan says:

    Does the option “to update or ignore users that already exist on your website” mean that you can enroll users who already have a site registration into a course via CSV? We have LearnDash running as part of a WP website with registered users, who are not necessarily enrolled in a course. So the uploaded CSV would include registered site users, so the uploader would ignore the registration process for them and just handle the course enrollment. Is that correct?

    Reply
    • Ryan
      Ryan says:

      Exactly correct. Note though that to update an existing user’s course/group access the CSV file MUST include both the current username and email address of that WordPress user. If either value doesn’t match, the update will be ignored.

      Reply
  4. Ludovic
    Ludovic says:

    Hi,

    I want to transfert learndash course.
    If I use this plugin to import the existing users from the site1 to the site B,
    Could you tell me if the progress of the user are imported ?

    Thanks
    Regards
    Ludovic

    Reply
    • Ryan
      Ryan says:

      Hi Ludovic,

      There is definitely no way (short of a fair bit of development work) to move progress records in LearnDash from one site to another. This module will let you import users and usermeta, along with course and group enrollments, but not anything related to progress or quiz data.

      Reply
    • Ryan
      Ryan says:

      You could potentially override it with code, but I wouldn’t even recommend uploading 1,000 users at once. This will push your server resources too hard, it’s a lot of emails to send at once, if you have a mistake in the import file it’s harder to fix, etc. Smaller batches are safer. The 1,000 limit we force isn’t a technical restriction, we added it so we don’t overload servers.

      Reply
  5. Luis Arriaza
    Luis Arriaza says:

    Thanks Ryan, I actually don’t need to send emails, I was just wondering because I’m only adding my existing WishList Member users from their respective levels to their respective courses on LearnDash, so I don’t need to send emails out, I already did some testing in my staging site and 1000 users are getting updated in about 2 minutes.

    I have 6 levels with 6,700 users each, I would have to create 7X6=42 CSV files to accomplish my import, since I’m not sending out emails I figure I could push it to 4,000 per file perhaps? or even 3,000 would save me some time.

    What I’m trying to do is some kind of migration withing the site, from WishList Member levels, to LearnDash courses.

    Reply
    • Ryan
      Ryan says:

      Certainly you could modify the code to allow that. It’s not something we could support, and if it were me I would probably still go with the 42 imports. 🙂

      Reply
  6. Luis Arriaza
    Luis Arriaza says:

    Thank you Ryan, I will do the 42 imports then, I’m good at listening to what is suggested.

    Thank you very much for the fast responses also, I’m a new customer of yours, I just bought the pro version 2 or 3 days ago I think.

    Reply

Comments/Questions

Please note that this is not an official support channel and questions/comments may go unanswered.
To request support, log in to your account and click Submit a Request.

Leave a Reply

Your email address will not be published. Required fields are marked *