Bulk Import/Export WPLMS via CSV

In version 1.9 we’re introducing the Bulk import/export feature in WPLMS. This feature will allow administrators to bulk import/export WPLMS components via CSV files. This feature adds a much needed flexibility in the WPLMS system, as now users can import information from custom LMS systems into WPLMS.

Labels used in this description :
Export system : A WPLMS Setup from where file is exported
Import system : A WPLMS Setup from in which file is imported

The WPLMS import and export system can be located in LMS -> Settings section.

Export System

WPLMS export is the key for the bulk import system. We recommend users to test the export system and understand how it works.
The export has following options :

1. Select Module : Select the relevant WPLMS Module.

2,3,4 : Use this to shortlist the modules you want to export.

5. Export content : The main content in the module. Like Course description for course, unit content for units, Quiz description for quizzes, assignment question for assignments, question content for questions etc..
Important : If this content is imported then the import will always create a new module (unit, course,quiz etc..) . In this case the ID component in the export file becomes irrelevant. However, If this content is skipped/not checked then it means you’re only importing the settings and other relevant information of the course in which case the ID of the component is very important.

6. Export settings : Module Settings are imported. This comprises of the Meta fields and values that you set in the admin panel. Information stored in Array format like question options, curriculum is displayed as string with each array option separated by pipe [ | ] . For multi dimensional arrays like Quiz questions, the second level arrays are stored with each array option separated by comma.
So a course curriculum setting will look like : Section Name|111|222|Section Name 2|333|444, where 111,222,333,444 are unit ids. Quiz question settings will appear like: 11,22,33,44|2,2,2,2
Where 11,22,33,44 are question IDs and the 2,2,2,2 are marks for each question respectively

7. Export Taxonomies : Various Taxonomies used in the theme will be exported. If taxonomy already exists in the import system the module will be automatically connected to it, otherwise a new taxonomy will be created in the import system.
For hierarchical taxonomies like : Course Category and Assignment type, the parent child relationship is not imported.

8. Export Comments : WPLMS uses WordPress comments for various purposes. Comments in WPLMS are used for : Reviews for Courses, Answers for Questions, Answers for Assignments, Notes for Units. If comments are imported with a module then all the above data is also imported.
If comments are imported for questions, then it would import the answers marked by various users, in case the question was already evaluated the evaluation marks are stored as comment meta which is also imported along with comments. For Courses, course reviews will be imported along with Review title and rating stars for the reviews.

9. Export Connected modules : This is the most important setting in export. This setting creates a chain of export data which are connected to each other. So, if you export a quiz with this setting, it will automatically export all the quiz questions along with their content in the export file. If Export settings and Export comments are also checked then this will import all questions with their settings and marked answers along with the quiz. Similarly for Units, any assignment connected to the unit will be exported. Similarly for the courses. A Course export with setting will import all the units, assignments, quizzes, quiz questions.
All the information is connected by ID values. Once again, ID values are important only if content is not exported, if export content (2) is on then ID values are only used to identify which unit is connected to which unit.

10. Export Users : This setting will import all the connected users to a module. So for a unit, all users who have posted a note/discussion will be imported. A User export comprises of all the BuddyPress field information and the wordpress information about the user.
When Users are imported from this file, the users are identified on basis of email values. If the email already exists in the Import system, the other information which is to be imported will update the already existing user. In case the email does not exist, but the username/userlogin exists then the import system will automatically create a new user by appending a random number on the username.

11. Export Connected user data : Connected user data like, User status in course, unit completion statuses, quiz timeline statuses, marks in quiz,course, assignments etc.. will be imported with this setting.
A sample export of this will help you in updating status of multiple users in a single course. Note the UserId values.

12. Start Point : Since this Export system has not been tested on the actual amount of data which can be exported, you may need to break the csv/data in chunks, which is where this value will be important. Like your setup has about 100 courses, but the export/import system is only able to export/import 5 courses at a time. Then create multiple export files.

13. Number of modules : Number of modules to be exported. Important to note is that this counts only the main number of modules to be imported. Like if you set this value as 5, and check the setting export connected modules, it will export 5 courses with all the modules the number of entries in which case would be much more than 5. Use this functionality with Start point to get best use of import/export system.

Understanding Exported File :

If you look at any export file, it will have 5 rows :

1. Table Reference : This is just a reference for WPLMS import. It is mostly the database table in which the value resides. However, for import it only works as a reference on how to handle the data. Most important is that this value is connected to the field value. So Table-Field paid should always be constant for import to work properly.

2. ID : This is the reference ID (not the actual ID), of the field. It helps the WPLMS Import system to make connections for import. So, the course ID value will always be same as the course setting ID, because these two are connected.
If Module content is imported then the actual value in this field is irrelevant, important is that this value connects modules with their settings. However, if Module content is not imported then the import system will try to find the actual value of the ID in the relevant table to import the values to.

3. Field : This is like a keyword which identifies the value. Important is that Table – Field relation should be maintained at all times. Also, in some cases the value which which needs to be stored in the field should be of some specific format.

4. Label : Labels are just for reference. In most of the cases you will find this in pure english, however in some cases like user export, this will contain important information.

5. Value : This is the actual value which needs to be stored in the field. Please refer the video to understand the correlation.

Import System

WPLMS import uses standard WP Functions for creating and inserting posts, meta information, users etc. which means it is safe and secure, in case import files are not properly created. However, it also means that it may put more load on server to maintain the consistencies.

This gives us a definite advantage that even if you skip some fields in import file, the system will automatically generate these.
Like for Module content, if you miss the post_date the system will automatically generate the date/time value. Similarly for other values.

IMPORT USE CASES

There are almost unlimited use cases for import export, however, we’ve mentioned few simple use cases below:

1. Import Questions : Sample Export file : http://goo.gl/dVn1kj , Multiple : http://goo.gl/eoJHxz

2. Import Assignments : Sample Export file : http://goo.gl/veBJcO

3. Import Units : Sample Export file : http://goo.gl/OGVQku

4. Import Quizzes : Sample Export file : http://goo.gl/2VlYUg

5. Import Courses : Sample Export file : http://goo.gl/P0cujA

6. Importing Users : Sample Export file : http://goo.gl/SYThCk

From above simple use cases, you can easily understand that you can club any two of the above and create an import file.
The import/export system will put a lot of load on your servers, as it will run a lot of sql queries, so it is recommended to do this when traffic is at its lowest.

VIDEO Tutorial