6

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?

3
  • I am think based on the answers thus far that using some sort of openid system might be best. Letting users login with facebook accounts etc. Commented Nov 11, 2010 at 21:32
  • Yes but what about the meta data created by specific plugins? E.g. installation 5 has a plugin that adds "twittername" to the meta data or something.
    – edelwater
    Commented Nov 11, 2010 at 21:40
  • Good point, though in this use case I don't think that will be an issue as my client has a very specific usage of the accounts and the users wont have access to the backend. Commented Nov 11, 2010 at 22:56

4 Answers 4

3

(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:

  1. The tricky thing is that the same user can have changed his password in installation 1 and in installation 2 OR a user is added in installation 1 under the same name as another user in installation 2 OR the user has another e-mail in installation 1 as in installation 2 etc..
  2. Even if you trigger the sync on any insert / update / delete (and rely on it to ahve convered all user databases there could be plugins that modify the meta user table and by which you lose control (so especially the user meta data creates lots of new use cases to take into account).

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.

6
  • I'm using these defines quite successfully on my end... Commented Nov 11, 2010 at 23:50
  • so ticket 13323 is bogus?
    – edelwater
    Commented Nov 12, 2010 at 9:42
  • @Denis: Do they refer to a table on the same or on a different database? The ticket was about incorrect escaping of the tablename if it includes a database name (dbname.tablename becomes ' dbname.tablename' instead of 'dbname'.'tablename', where the single quote should be a backtick that I can't escape here).
    – Jan Fabry
    Commented Nov 12, 2010 at 12:44
  • 1
    I've all sites using shared user and usermeta, each with a different table prefix, all in the same database. Commented Nov 12, 2010 at 13:59
  • ticket 13323 is about having the shared user tables in another database then the blogs database. that does not work. if the user table is within the same database, it works.
    – hakre
    Commented Nov 12, 2010 at 22:41
1

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.

1

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

0
0

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.

2
  • HI,they will likely not share the same server Commented Nov 11, 2010 at 21:28
  • You would have to make certain that every single bit of user changing code honors this arrangement, in particular in every plugin you install. Not feasible.
    – Raphael
    Commented Nov 12, 2010 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.