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.

This is essentially a repeat of this question, but it has not been answered.

I am trying to create an SSO system between two separate WordPress installs that are on different servers using different databases. The main site has a full database including a users table containing over 300,000 users. Because of the size of the users table, we do not want to replicate each of them on the second site or do a traditional SSO system where each user is created in the database as they login. Ideally, we would like to reference the users table on the main site and use those same users on the second site.

So far I have tried using wp_remote_post() to send a user object to the second site while overriding the pluggable.php functions and setting the $current_user global with the posted user object. This, however, isn't working as well as I'd hoped because the methods that are normally available in the WP_User object are not available in the posted object, which results in fatal errors when methods like $user->exists() are used.

I am aware of the CUSTOM_USER_TABLE solution, but that obviously won't work in this example as the sites are on separate servers with separate databases.

TL;DR: Need SSO. Separate servers. Help.

share|improve this question
1  
Are you sure you can't access the main site's DB from a different domain/server? Because if you can do this, then you can use one DB for both sites and then you can use the suggestions from the other question. This will almost certainly have an impact on performance, since it will query a different server. If you can't do that, you should consider some kind of syncing between both databases, or maybe trying a WP Multisite network(this will require both domains to point to the same server though). Other than that I really can't figure-out a way to do this without maybe hacking core files. –  Nikola Ivanov Nikolov Dec 14 '12 at 14:08
    
Thanks, but we're trying to keep them separate so we don't sacrifice space and performance on the main site. We could use the same DB server, but we only want to share the users table and keep the posts, etc. separate. I think the only solution might be an SSO system that creates the users on the second site, but that's not ideal. –  Hugh Lashbrooke Dec 14 '12 at 14:14
    
The problem is that WordPress is made to use one database server for everything. So, I really doubt that what you're trying to do is achievable with WP as a base. I mean even if you rewrite the WP_User object to make queries to the original DB, you will still add load to it, which is definitely not good for it(considering the amount of load that it should already have). Sorry, I can't help you with that :/ Good luck with it and if you figure it out, post the answer here :) –  Nikola Ivanov Nikolov Dec 14 '12 at 14:22

2 Answers 2

up vote 0 down vote accepted

After a lot of searching and asking people who are far more clued up than myself, I have concluded that this is impossible mainly because it requires two concurrent DB connections.

In the end, my SSO solution was to build a more traditional SSO system that creates users in the remote site using the user data from the main site. It also updates them on each login to make sure the profiles always stay up to date.

share|improve this answer

I do think that that is possible. In fact, I'm trying to do it myself. I'm a recent premium subscriber at WPMUdev.org, and there you have several topics on their support forums about this subject.

Although installing Wordpress Multisite gives you access to that option from the start, if you've got different domains you have to create a network for each of them, and then "connect" them with plugins such as Multi Domains, as explained here

I haven't been able to set this up the right way, so in the mean time I've been experimenting with the User Synchronization plugin and this one is quite useful because once the user is registered in one blog, it is registered also on the rest of blogs. The disadvantage: you still have to logon on each site you visit.

I'd like to add a definitive solution, but that could be good starting point.

share|improve this answer
    
That doesn't really help in my case as I am not using multisite to run these sites. I say in the question that I am running these sites on separate servers with completely separate databases. If you are running multisite then it's fairly easy to set up an SSO system using the plugins you mention here. –  Hugh Lashbrooke Jan 7 '13 at 7:52

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.