Leave a Reply

4 comments

  1. (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.

  2. 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.

  3. 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.

  4. 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