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.
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 edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Dec 14, 2012 at 13:52 Hugh LashbrookeHugh Lashbrooke 911 silver badge7 bronze badges 3 |2 Answers
Reset to default 0After 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.
I do think that that is possible. In fact, I'm trying to do it myself. I'm a recent premium subscriber at WPMUdev, 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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745259753a4619157.html
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 Commented Dec 14, 2012 at 14:22