2017年6月13日 星期二

Solution for Plugin LearnPress Export Import - Import function not working issue

Learnpress is an open source plugin in wordpress for building online course.

I am trying to find a way to export and import learnpress course for my wordpress website.
Then I found this plugin.

However, when I try to import from the exported XML file. It did not work as expected.

After debugging for a while, I changed some code to fix this issue.
Here is the version information that I tested with:
Plugin version : 2.0.1
Learnpress version: 2.1.6.1
Wordpress: 4.7.5

The root cause is that the wxr version is not correct in the export XML file.

  • Workaround:

Open the XML file you exported and change the wxr version to 1.2.
<wp:wxr_version>1.2</wp:wxr_version>
The import function should work now. However you need to change the version every time is very annoying.


  • Solution:

Change the code in learnpress-import-export\incs\export\lp-export.php
Modify the code from
<wp:wxr_version><?php echo LP_IMPORT_EXPORT_VER; ?></wp:wxr_version>
to
<wp:wxr_version><?php echo 1.2; ?></wp:wxr_version>
Try to export the lesson and course again. The import function should work fine now!

沒有留言: