TeknoFlair

TeknoFlair Logo

How to import users to the LearnDash website?

import users to the LearnDash
Share Now

To import users into a LearnDash website, you typically need to use a CSV (Comma-Separated Values) file that contains user information. Here are the steps to import users into a LearnDash website:

Prepare your CSV file: 

Create a CSV file with the user data you want to import. At a minimum, you will need columns for user information such as usernames, email addresses, and passwords. You can also include additional information like first name, last name, and any custom user profile fields you have set up in LearnDash. Here is an example of a simple CSV file structure:

Install a User Import Plugin

LearnDash itself doesn’t provide a built-in user import feature, so you’ll often need to use a WordPress plugin to handle user imports. Some free plugins for user import include 

Install and Activate the Plugin: 

If you’re using a user import plugin, you’ll need to install and activate it on your WordPress site. Follow the plugin’s installation instructions.

Goto Plugin > Add New and install compatible plugins you have fulfilled requirements. I’ve installed Import and export users and customers using this plugin to import users in LearnDash courses.

import users to the LearnDash 1

Access the Import Tool: 

Once the plugin is activated, you’ll usually find an option for user imports in the WordPress admin area. Now goto Tools > Import and export users and customers.

import users to the LearnDash 2

Download CSV File: 

Now goto Export option and download the CSV file. The plugin should provide options to map the CSV columns to corresponding user profile fields in LearnDash. Remove extra columns in CSV you will need columns for user information such as user_login, user_email, first_name, last_name and course_XXXXX_access_from.

import users to the LearnDash 3

Map CSV Columns to User Fields: 

This step is crucial. You need to ensure that the data in your CSV file aligns with the user profile fields in LearnDash. For example, map the “username” column in your CSV to the “Username” field in LearnDash, and so on.

import users to the LearnDash 4

Add Custom Code in Snippet:

Before Import CSV now add this custom code in the Snippet file. First install WP Code lite plugin and then create a new snippet file and enter this custom code and click the Update button.

import users to the LearnDash 5

/**
 * Change user `course_access_from` date to timestamp
 */
add_action( 'post_acui_import_single_user', function( $headers, $data, $user_id, $role, $positions, $form_data, $is_frontend, $is_cron, $password_changed ) {
    $courses = array();

	foreach ( $headers as $i => $header ) {
		if ( str_contains( $header, 'course_' ) && str_contains( $header, '_access_from' ) ) {
            $courses[$i] = array(
                'key'   => $header,
                'value' => $data[$i]
            );
        }
	}

    foreach ( $courses as $course ) {
        $key    = $course['key'];
        $value = current_time('timestamp');
        if ( $value ) {
            update_user_meta( $user_id, $key, $value );
        }
    }
}, 10, 9 );
import users to the LearnDash 7
import users to the LearnDash 8

Start the Import Process: 

Once you have configured everything, start the import process. The plugin will read the CSV file and create user accounts in your LearnDash website based on the data in the file. Now Goto Import and upload CSV file setup some settings and click to import process now.

import users to the LearnDash 9
import users to the LearnDash 10
import users to the LearnDash 11

Review and Verify: 

After the import is complete, review the imported user accounts to ensure everything looks correct. Verify that user data, roles, and any custom fields are accurately imported.

import users to the LearnDash 12
import users to the LearnDash 13

Test User Logins: 

Have a few users try to log in to their accounts to make sure the imported accounts work as expected.

Please note that the specific steps and options may vary depending on the user import plugin you choose. Always consult the documentation provided with the plugin for detailed instructions tailored to its functionality.


Share Now

Leave a Comment

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

Scroll to Top