Skip to content

Instantly share code, notes, and snippets.

@trey8611
Last active December 10, 2020 05:34
Show Gist options
  • Save trey8611/01142572c5cc00b76d2e53b545d9f3c7 to your computer and use it in GitHub Desktop.
Save trey8611/01142572c5cc00b76d2e53b545d9f3c7 to your computer and use it in GitHub Desktop.

WordPress doesn't allow multiple users to share the same e-mail address, but there are certain plugins that change that behavior. This is an example workaround using the Allow Multiple Accounts plugin.

  1. Install and activate this plugin: https://wordpress.org/plugins/allow-multiple-accounts/

  2. Use a custom PHP function in the import to generate a fake e-mail for the imported user(s): [fake_email()]. Screenshot: https://d.pr/FREE/Yr0MOL.

  3. Store the real e-mail in a Custom Field named '_email_temp'. Screenshot: https://d.pr/ERw4F9

  4. Use our API to change the users e-mail to the real e-mail after the user is saved.

Here’s all of the code you’ll need to add inside the Function Editor via All Import -> Settings: https://d.pr/ef9JAn.

That’s it. Keep in mind that this code runs for all imports, so you might consider wrapping it in an if conditional based on the import ID ( which you can get from $_GET['id'] for manual runs or $_GET['import_id'] for cron job imports ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment