Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The organization I work for would benefit if we could take the existing WordPress installations that are located on several (~5) different servers and be able to use a universal database with the users table only. The individual servers would use a database for the remaining content.

The idea is this. Have a "main" server with all of the user's data (some 300+ users) which whom a network admin can give/edit permissions to these users on each of the other servers.

This way, when a user logs in to one WordPress installation on one server, the user could visit another WordPress server and still be logged in with various permissions on the various servers.

This would be a 1:1 relationship for WordPress Network to Server. How would cookies or sessions need to be utilized in order to allow this?

Would an outside API login system need to be used in order to accomplish this? Or could this be done within the WordPress core files?

share|improve this question
    
Why is it not possible to just use a WordPress multisite setup and combine all the servers to just one. much much easier on everyone involved. –  westondeboer Nov 7 '12 at 19:23
    
Certain installs are too resource intensive to be able to use them all on one server. In addition to this, we have our intranet wordpress install seperate from a hosted install. –  jmalais Nov 8 '12 at 20:45
    
I would think that just paying for two server bills would be much less than five servers. Upgrade your apache server and get a mysql server. You only need to upgrade one WordPress install. Then you are able to have site wide login without creating a custom WordPress plugin. Then restrict access to subdomain/domain htaccess for intranet. Just my two cents. Good luck! –  westondeboer Nov 10 '12 at 20:11
add comment

1 Answer 1

up vote 3 down vote accepted

It may be possible. A lot of the core API that deals with logins and cookies is pluggable.

You could replace wp_set_current_user with something that queried your external database rather than the internal one, for instance.

Authentication is already done via a the authenticate filter (wp_authenticate is the function that does this, and the filter is added in wp_signout).

In short, there's plenty of ways you could hook it, do your thing and change stuff. You would lose, however, almost all of the users API (no get_users, no user admin area, etc), except for your main site, where the user functionality resides.

An alternative approach would be to have all ~5 servers/WP installs share the same, external database server and database. From there, set a custom user table in each wp-config.php, and each separate install with share the same user data. You'll also need to set a different $table_prefix for each site.

Capabilities and roles will be different on each site, due to the way WordPress stores roles/caps (they get prefixed with $table_prefix). All the core user data, namely usernames, emails and passwords, will be shared between servers.

Of course, this is just a WP multisite install without the convenience of multisite.

Multisite + a domain mapping plugin is probably what you want. Or you could role your own sunrise.php and skip the domain mapping plugin. It should be possible to put multiple applications servers running a WP install with a shared database server. Point all the domains at a load balancer that sends traffic to one of the application servers and you're done.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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