How to use s2Member Pro export/import function

The s2Member user export/import function is a powerful feature, but needs some understanding to be possible you to do it smooth (at first try :-) ), so I explain here what I find as best way. Note, that this works with s2M Pro only.

 

Exporting user data

Export Step 1:

 1

In the WordPress Dashboard, in the left-hand navigation bar:

  • Click on s2Member (Pro), then

  • Click on Import/Export

Export Step 2:

  • Check if "Imports / Exports" tools are set in "Advanced mode" - if you see following picture:

fc123bb1ac4804a9dd462b8f928ea7e1

you should click the link "click here to enable the Advanced Import/Export Tools" to set tools to Advanced mode. Should see it like this:

cde4d45ee2876a088650033e3c627c18

This is one time setup, you may skip if you see it is in Advanced mode already.

Export Step 3:

  • Click on Advanced User/Member CSV Exportation

  • Under the heading CSV File Exportation, there would be and indication of the total User/Member rows in the database. Change the limit from 1000 to the number required, e.g. 2000 as per the screenshot. Not sure how this will works with large databases, you may need to split them and export part by part. If you split, then all steps bellow you must do for/on each part separately.

  • Clock on the Export Now button

  • The file would have exported to your Download folder

b793770bb8b05b795f457c2a0809981b

Export Step 4:

  • Save the exported .csv file as an Excel Workbook (.xlsx) file. Means, open the .csv file with your favourite spreadsheet program, then save as .xlsx file. This is need to be possible to share the file with someone else.

  • Delete all columns, except those you need. They can be:

    • ID

    • user_email

    • role

    • meta_key__first_name

    • meta_key__last_name

    • meta_key__wp_capabilities

    • meta_key__wp_s2member_notes

    • custom_field_key__address

    • custom_field_key__business_name

    • custom_field_key__city

  • Warning: don't change column's names - they are used in importing, must be the ones, which this tool creates.
  • Warning: ID column is a must – importer needs it to ensure that it sets the exactly user.

Export Step 5:

  • If you need to delete a member, you must delete it manually on the site. Importer don't touch missing members, thus when you delete a member from the Excel file, it will remain on the site.
  • Delete admins - find the rows with "administrator" on it, check the name and delete, if this is admin. Importer can not change admins and you will get errors. Not strictly needs, as all other rows will be imported well, but it's good to avoid errors.
  • If you choose to export s2Member's EOT (end of the time) date (when the membership expires), it will be like "1429621332". Don't be surprised. This is an integer value in "seconds since Unix epoch" - widely used date format in server's world. You may need to find an (online?) converter to read them, or to change them. Note, that no everyone user have EOT date.
  • If you choose to export other dates like "last payment time", they are in "MM/DD/YYYY" format, like "05/28/2012". Excel don't like this format, may or may not show a date. Turn that columns to "text only". You must keep that format when import users back.
  • If you choose to export free users, those on s2Member's "level 0", in the "role" column will be value "s2member_level0". It's perfect, but importer don't like it, change "s2member_level0" to "subscriber" everywhere.
  • Save the changes you made.

Export done

Now you can do need changes on user's data, or can save the file as backup etc.

 

 

Importing user data

Import Step 1:

  • If you choose to export s2Member's EOT (end of the time) date (when the membership expires), it will be like "1429621332". This is an integer value in "seconds since Unix epoch" - widely used date format in server's world, and you must keep that format when import your info, so check if it is saved like this. You may need to find an (online?) converter to read them, or to change them. Note, that no everyone user have EOT date. Generally, not a good idea to change this info, as it is a key value for s2Member, better omit it (delete this column).
  • If you choose to export other dates like "last payment time", they are in "MM/DD/YYYY" format, like "05/28/2012". Excel don't like this format, may or may not show a date. Turn that columns to "text only". You must keep that format when import users back, so check it well.
  • If you choose to export free users, those on s2Member's "level 0", in the "role" column will be value "s2member_level0". It's perfect, but importer don't like it, change "s2member_level0" to "subscriber" everywhere.
  • Save the Excel sheet as CSV file (.csv extension)

Import Step 2:

  • Remove \r from "new line", use text editor (not "text processor" like Word), Vim works best for me.

This step may not be need at all, but I am not sure. New rows in Apple's OS are different than Window's OS, yet different that Unix ones (site runs in Unix environment, usually). I think browsers must set this automatically, but as I had problems years ago, I prefer to do this manually. Well, may try to skip that step (if you are brave enough), if something goes wrong you still can go back, do it later and repeat importing.

Import Step 3:

  • Split the file to need parts, with members less than 1000 each, save in different CSV files. May save several files at Step 1 above, but you may need to repeat Step 2 on each of them.
  • Copy the index line (column names) as first row in each file.

This is because we have limitation "max 1000 rows" in Importer. Longer files may, or may not go well, because need time to process them may hit "time out" limit in the browser. So 1000 rows are safe number. If your line is slow, or your server is slow, and you can not import 1000 users, you can reduce this number.

Import Step 4:

  • Check if" Imports / Exports" tools are set in "Advanced mode" - if you see following picture:

fc123bb1ac4804a9dd462b8f928ea7e1

you should click the link "click here to enable the Advanced Import/Export Tools" to set tools to Advanced mode. Should see it like this:

cde4d45ee2876a088650033e3c627c18

This is one time setup, you may skip if you see it is in Advanced mode already.

Import Step 5:

  • Click on Advanced User/Member CSV Importation (click image for bigger version)

852c28122ebab5aebd41a269757fb979

  • Here we have two ways to import:
    1. Import as files - click "Browse" or whichever button is there to upload the file, then click "Import now" button. Upload one file at a time.
    2. Copy-paste the content of CSV file to the text area, then click "Import now" button. Again, one file at a time.
  • It is possible to use both ways for different parts, if this is better for you.

Done

 

Limitations with s2M export/import:

  1. don't update admins (good for security tough)
  2. don't exports passwords
  3. don't understands "s2member_level0" (needs "subscriber") as role
  4. Excel reformats dates
  5. don't imports usernames
  6. must use "advanced i/e mode"
  7. don't imports new users at all, if you put them between existing users. Needs at least an ID in "wp_users" table (not bad, as may be missing info, and good for security too). To import new users you must create a CSV file without "ID" column.
  8. Import procedure don't delete missing (not imported) users

 

Final words

Well, that's all the "magic". Ask any questions.

Note, that functions at s2Member can be changed and this guide can not be accurate at some point. In this case please tell me, so I can correct it.

Disclaimer: I am not affiliated by s2Member's team, all the info I show here is "learned by hard way" as usual user (working as support to my client, and helping them to do this). It works (at the time I write this), but this is not the official manual.

This entry was posted in Hacks, News and Updates and tagged , , , . Bookmark the permalink.

Leave a Reply