memberful/memberful-wp — pull request #92 by BRMatt (2014-05-30 14:59:55+00:00)
Title: 90 prevent user creation race condition

See https://github.com/memberful/memberful-wp/commit/5cbae6e56b6f72f23f95d0459cefe88838d3f57c for a brief overview of how this works.

@tollmanz Please could you take a quick look when you get a chance to check I'm not doing something that goes against WP standards?

The problem is that sometimes two web requests (webhook + hitting the sign in endpoint) create a user simultaneously with the same username/email, and next time the user signs in the plugin interprets this as a hacking attempt and prevents them from signing in. This bypasses WordPress' dup user detection because the users are created near simultaneously.

This seems like the most straightforward approach I can think of.