The Invite Codes extension stores all invite codes in a simple custom table in the WordPress database. This table is {prefix}wpmem_invite_codes (so if you use the default standard prefix “wp_” then the table would be wp_wpmem_invite_codes).
Depending on your version, you may also see wp_wpmem_invite_codes_meta, which is for storing data on invite code use. This is not the same table and shouldn’t be used for importing.
If you need to create a large number of invite codes in bulk in an application like Excel, save as a CSV file and import into the wp_wpmem_invite_codes table directly using whatever database manager you use (such as phpMyAdmin or MySQL Workbench).
The columns your CSV should contain are:
- invite_code – (required) – This is the actual invite code itself. These are case sensitive and can be all caps, all lowercase, or mixed case. Numbers are allowed.
- description – (optional) – This is the description text for the code. You can use this for a note about the code, such as what it’s for, if it’s for a specific user, etc.
- limit_use – (required) – MUST be a value of “y” or “n”. If you plan to limit the number of uses for the code, this should be “y” otherwise, “n” (no quotes – that’s just for emphasis).
- uses_remaining – (optional) – if limit_use is “y”, then this field needs to be included with the number of times the code can be used – 1 to whatever number of uses.
- date_created – (required) – The date you are adding this code (cannot be in the future). MUST be in MySQL timestamp format which is YYYY-MM-DD hh:mm:ss. (do not use “/” and do not miss the hours:minutes:seconds).
- date_active – (required) – The date the code becomes active. MUST be in MySQL timestamp format which is YYYY-MM-DD hh:mm:ss. (do not use “/” and do not miss the hours:minutes:seconds).
- date_expired (optional) – This is the expiration date for the code. This is optional, but if used it MUST be in MySQL timestamp format which is YYYY-MM-DD hh:mm:ss. (do not use “/” and do not miss the hours:minutes:seconds).
IMPORTANT: The fields noted as “optional” above are optional with regards to whether the field can be empty or not. However, your CSV file MUST include a column for this field, even if it is empty.