Hallo, I need to merge users from several souces some how, for example facebook, Google, plaxo... Currently I have this structure in my database:
USERS_MYSITE
mysite_user_id | parameter | value
------------------------------------------
223 | firstname | Tom
223 | lastname | N.
223 | birthdate | 1985-01-30
USERS_FACEBOOK
mysite_user_id | facebook_user_id | parameter | value
-------------------------------------------------------------
223 | 456353453 | fname | Tom
223 | 456353453 | lname | N.
223 | 456353453 | birth | 1985-01-30
USERS_GOOGLE
mysite_user_id | google_user_id | parameter | value
-----------------------------------------------------------
223 | tomtom22 | fn | Tom
223 | tomtom22 | ln | N.
223 | tomtom22 | brt | 1985 JUN 30
USERS_VIEW
mysite_user_id | remote_user_id | site_name | parameter | value
---------------------------------------------------------------------------
223 | 223 | mysite | firstname | Tom
223 | 223 | mysite | lastname | N.
223 | 223 | mysite | birthdate | 1985-01-30
223 | tomtom22 | google | fn | Tom
223 | tomtom22 | google | ln | N.
223 | tomtom22 | google | brt | 1985-01-30
223 | 456353453 | facebook | fname | Tom
223 | 456353453 | facebook | lname | N.
223 | 456353453 | facebook | birth | 1985 JUN 30
Then SELECT FROM USERS_VIEW WHERE mysite_user_id = '223' and i got all user information. After that i can use several transporation arrays, to transform all remote data to my format
Array("firstname" => Array("fn", "fname"), "birthdate" => Array("brt", "birth"), ...)
same goes with values. Next depending on what user selected as his primary data i can show it.
Problem is that I've never done it before, so maybe somebody knows how to do it better. Please share your ideas.
Thank you.