pmpro-import-users-from-csv icon indicating copy to clipboard operation
pmpro-import-users-from-csv copied to clipboard

Importing checkbox grouped fields don't work

Open andrewlimaza opened this issue 6 years ago • 2 comments

Import Users From CSV does not support checkbox_grouped fields for Register Helper.

On export, it is a comma-separated list but trying to import that same value does not work. It never updates the values.

andrewlimaza avatar Jul 10 '19 06:07 andrewlimaza

This still seems to be an issue. Did you find a solution for it?

I wonder, will this arrays Gist work https://gist.github.com/andrewlimaza/50a3d1ab70c09428b6236fa35a932c0d ?

I will probably test it tomorrow.

VR51 avatar Aug 26 '20 01:08 VR51

The gist linked in my above comment resolves this issue.

The only problem is that user meta held in an array for a PMPro grouped checkbox field is exported to CSV with a space after each comma between each value in the array. This means anyone who inspects the PMPro export file to see how data in grouped checkbox fields should be formatted for import will fail their import attempt because of the extra space. Also, anyone who exports user data from PMPro in order to import it into another site (or back into the source site) will not see any grouped checkbox fields imported.

For example,

Exported user data in a grouped checkbox field that holds a list of fruits is exported as "apple, banana, cherry" whereas it needs to be exported by PMPro as "{apple,banana,cherry}" in order for it to import correctly i.e. no space after the comma.

If the Gist is added into the importer plugin maybe you could update the PMPro user exporter to automatically wrap array data in curly braces (as required by the Gist) and to remove the space between values or maybe update the gist so explode at ', ' (comma-space).

Thanks for the Gist, Andrew, and thanks for all your work on PMPro Import Users from CSV.

Lee

VR51 avatar Aug 28 '20 01:08 VR51