Multiple WP sites sharing wp_users db table
-
Hello,
I am looking into the feasibility of running two WP (developer) instances within Cloudron.
I would like to share the WP users between the two.
I don't think this is possible by default since each MySQL db is separate per WP app instance.
Has anyone done this before? Is it possible to do?
I would think it could be possible by GRANT'ing the WP DB user (defined in wp-config.php) with the host/IP ??? e.g. adding the @172..... IP to the user so that it can access the db table.
Thoughts?
Thanks!
-gregg
-
Take a look at this:
https://wordpress.org/plugins/wp-remote-users-sync/ -
-
Yea, I saw that. I configured that about a month ago between two sites (non-cloudron) in separate locations.
That involves enabling the App Passwords, manually creating the roles, and some other nuances.
For a "local" instance -- e.g. both WP instances are within the same cloudron -- while this option is viable, making remote API calls, IMO, might be a little overboard.
I've considered this as a last option if I need to.
Thanks for the reply!
-
@ChicagoGregg I’m curious now too lol
Try it out! You’d need the host IP like you mentioned and also the username / DB name of the specific WP instance that would be the “DB host” In theory…From what I understand cloudron makes a new table and user are made per app all within one SQL instance (service) so I’d imagine It could work
Note: if you’re only trying to use the user table and then use different/related tables for each apps main use cae you might run into a WP/logic/DB issue - just an assumption
-
@ChicagoGregg said in Multiple WP sites sharing wp_users db table:
I would like to share the WP users between the two.
Is this something supported by WP ? How can it share users but not anything else? It writes to db1 for users and db2 for other things like posts/comments ?
-
@girish said in Multiple WP sites sharing wp_users db table:
@ChicagoGregg said in Multiple WP sites sharing wp_users db table:
I would like to share the WP users between the two.
Is this something supported by WP ? How can it share users but not anything else? It writes to db1 for users and db2 for other things like posts/comments ?
Sure, this is done currently on WP sites even when cloudron isn't in the mix. For simplicity of this thread, I was just referring it to wp_users, but it also requires usermeta.
I wonder how the bigger sites using WP also have their topology laid out with MySQL DB's clustered, and even with something like Kubernetes.
I would love to find a tech paper somewhere on this. And then, when it comes to having a larger website that is load balanced across disparate physical locations, how Cloudron could (if possible) be laid out to handle the workload. I'm thinking that it would be difficult and, in these situations, it might be best to simply have a dedicated host running, for example, Docker, Portainer, Kubernetes, MySQL (clustered), etc.
==========
Ok, it might be that I'm the guinea pig for this to test to and validate this works as expected.
I've found the below two articles to be very valuable.
-
How to Share Logins and Users Between Multiple WordPress Sites - https://kinsta.com/blog/share-logins-wordpress/
-
The Ultimate Guide to WordPress User Roles and Capabilities - https://kinsta.com/blog/wordpress-user-roles/
After reading the above two, I think the WP sites would have to use the same MySQL database, but have a different DB table prefix for each site (for the non-wp_users and wp_usermeta tables). The WP hook that the first article references is essentially to clone the user capabilities from one site to another within the same MySQL database upon modification.
Basically, here is what I'm working on.
Site #1 - Primary website (domain.org) that hosts the home page / landing page. Introduces the visitor to the society, its features, how the public/private memberships work, how to join, etc. This also will likely handle some administrative-related functions (including plugins), e.g. CRM, Support/Ticketing system, newsletter blasts, etc. This might also be the primary interface for where user roles, metadata, etc. are administered (TBD).
Site #2 - Social website part of the society (domain.social). This runs the social platform, event calendar, etc. It will also have such WP plugins like AutomatorWP and WP Fusion (amongst others).
Site #3 (TBD) - Media platform (domain.tv). This will handle a "media" related matters... Very similar to such sites like YouTube, Rumble, Bitchute, Odyssey, etc. and/or providing a "Netflix-like" type site. Users, based on their membership level, would be able to access this site. The users would likely also be "synchronized" to this site.
For now, I will be working on checking into the feasibility and implications for Site #1 and Site #2 "synchronization".
I will find out also what drawbacks, if any, exist for such things like having AutomatorWP (Site #2) trigger certain events and if it would (could) be picked up by the CRM (Site #1).
I would love to keep the administrative-related functions separate from Site #2 and Site #3. No need to have additional bloat where not needed.
So, within the next month, I plan on getting all this in place. I will do some testing and validation in the next few weeks.
If anyone has information, tips, etc. please do chime in!
Looking forward to checking this out.
-gregg
-