As the title suggests, If you had to synchronize WordPress user accounts across multiple domains and installations without using WordPress MU how would you do it?
Leave a Reply
You must be logged in to post a comment.
As the title suggests, If you had to synchronize WordPress user accounts across multiple domains and installations without using WordPress MU how would you do it?
You must be logged in to post a comment.
(side note) In wp-config you can set:
define(‘CUSTOM_USER_TABLE’, $table_prefix.’my_users’);
define(‘CUSTOM_USER_META_TABLE’, $table_prefix.’my_usermeta’);
So I would expect this to work especially for the case when you have centralized your user database… but it does not: http://core.trac.wordpress.org/ticket/13323
(and a username/password for the remote database to get the info from)
I think this is the best way to go: 1 db with the user table and the user meta table.
Nacin writes here that there are multiple plugins who provide this functionality more
robustly here so I assume there are plugins for this. (I have not found it yet).
I found: http://wordpress.org/extend/plugins/wpldap/ but that would require the different domains (“ldap” domains) are synchronized / have a trust relation. But as I read there must be other plugins for this this also.
Why I would NOT sync as indicated above and use a central database:
Writing your own sync e.g. with dbsync with some code around it to check for all synchronization cases is difficult because of all the use cases. there are many companies who have products for this for e.g. enterprise CRM systems interfacing with lots of other contact databases and which require cleansing and validation of user data but none are perfect.
Maybe you could also add additional requirements like “only register/update on site 1” and then use site 1 for all further synchronization. Then again… plugins that add specific user metadata… in e.g. installation 5 would not sync their changes to e.g. installation 3. So additional you need then a diff with the installation 1 with all other installation and … if there are differences … see if can cover them in as much as patterns possible. Treat the exceptions then as manual actions.
You can use OpenID for user authentication, e.g. provided by the plugin OpenID. This is invariant over the whole web, so in particular for your n WordPress installations.
Of course, WordPress specifig user settings would not be synchronized.
Are they on the same webserver/mysqlserver?
If they share the same mysqlserver you can hook in the registration and add the user in more then one database.
Or you could create a file that includes a user via $_POST/$_GET, be sure it’s protected with a token or something.
Thats what I would try to do.
There is now a plugin serving that purpose.
User Session Synchronizer allows you to keep the user logged in from one wordpress to another by synchronizing user data and cookie session based on a verified email.
The user email is encrypted based on the current user ip and a secret key shared by the synchronized wordpress installations.
Plugin
https://wordpress.org/plugins/user-session-synchronizer/
Repo
https://github.com/rafasashi/user-session-synchronizer
Resources
http://subinsb.com/set-same-cookie-on-different-domains