We’re looking to create a network of BuddyPress sites that share a common design, a common theme and some common content, but the same userbase across all network sites.
Each user will ‘belong’ to a network site, so whilst people can browse the London, New York and Sydney editions, they will need to ‘belong’ to one of these sites:
- ldn.mainsite.com
- nyc.mainsite.com
- syd.mainsite.com
Each subdomain-based BuddyPress site will feature different content depending on the location to which the site is based. Logging in to the network will mean they are logged in across all of the sites (SSO).
Is this possible with WordPress, BuddyPress and/or WordPress MU, or will this require some significant work on top of the existing code? (Or, would it be better doing this from scratch on top of something else?)
BuddyPress is compatible with a WordPress Multisite setup. There are several different ways to set it up.
By default, BuddyPress data is stored in a networkwide way. Generally, that means that, within the network of sites, only one site is dedicated to BuddyPress features/content – you might think of this as the “community” site within a larger network of blogs. However, it doesn’t sound like this is exactly what you’re looking for. So there are a few other options.
The first option is a BP flag called
BP_ENABLE_MULTIBLOG
. When enabled, BuddyPress content can be viewed on any site on the installation – such as ldn.example.com, nyc.example.com, etc. However, the content is still stored in an installation-wide way. That is, while you’ll be able to view groups, profiles, etc on many different sites, they will all be the same groups, profiles, etc. You can read more aboutBP_ENABLE_MULTIBLOG
on the BuddyPress Codex, where I recently tried to spell out the use case (it’s an often-misunderstood setting): http://codex.buddypress.org/bp_enable_multiblog/If you want to have separate BP content from site to site – so that London groups/profiles/etc are listed separately from NYC groups/profiles/etc, and so on – there is a second option called BP Multi-Network. This is a fairly new feature in BuddyPress (since BP 1.5), and requires some additional network plugins (one to create multiple networks, like Networks+ http://wpebooks.com/networks/, and one to enable the BP Multi Network functionality within these networks https://wordpress.org/extend/plugins/bp-multi-network/). Read more about this functionality here: http://wpmututorials.com/news/new-features/multiple-buddypress-social-networks/
If you want something a bit more sophisticated, where some BP content (like, say, Profile data and Friendships) are shared between sites, but other stuff is site-dependent (like Groups), it can be done, but will take a fair amount of customization. The setup I just described could be achieved through a combination of
BP_ENABLE_MULTIBLOG
and some judicious use of group metadata (so that certain groups are tagged ‘London’, etc). Here is a plugin that may get you somewhere with this idea: https://wordpress.org/extend/plugins/buddypress-group-tags/The problem that you are describing is actually exactly what WordPress MU (which I believe is now referred to as WordPress Multisite) was designed to handle. So the short answer is: As long as everything is on a subdomain you will have no problem with SSO if you use WordPress Multisite.
For the long answer continue reading:
With WordPress Multisite all user information is stored in a single table (wp_users) while the site specific data like posts, comments, and tags will be prefixed in the database with the site/blog id (something like wp_2_posts where 2 is the site/blog id).
The login session is shared between sites with the same root domain (ie. ldn.mainsite, nyc.mainsite, and syd.mainsite will all share a login session), meaning that a user who signs in to one of those sites will be able to move to another site on the same subdomain without needed to sign in again (SSO at its best).
BUT here is the catch, if you have a site in your network that is using a different root domain, then although the user login information (username/password) is shared (because it still uses the wp_users table), the login session is not shared so the user will have to log in again.
In regards to the ‘belonging’ feature… I’m not exactly sure what you are mean by this but I believe (emphasis on believe) that wordpress keeps track of which sites on your network a user has explicitly logged in to… and if they have logged into a site they will appear under the site admin > user list for that site as well as the network admin > user list.