User with same Mail but a different additional info(like domain)

I know this is not the way u should go, but my customers want it so im looking for ways. Requirement:

  1. WP with one DB (3 Domains sale the same stuff)
  2. 3 Domains which use this DB (can be more later), this should work with on fly rewriting over hooks
  3. user registered should be only able to login in the domain where he is registered, but should be able to register on the other 2 domains with same data.

My ideas: Add the Domain as user meta Problems: E-Mail can be use only once on WordPress I can't check the domain, for example in own code I would do the following which seems is not work on WordPress because wp use a Select statement which take a email lookup with a limit 1.

SELECT * from users WHERE email = “myemail” and password = PASSWORD(“mypw”) and domain = “thedomain where user is”.

Maybe Solutions: Add the domain to the email on fly so user use [email protected] and in the db I will add [email protected], but this brings new problems.

In the theory, i should do modification on the login query but this seems not so a good idea.

This Question is a little about WooCommerce but the main functions i need comes from Wordpress so i think this is the better place here.

Thanks

Topic wp-user-query email user-registration users Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.