Share nodes and users across multiple sites

by raf   Last Updated July 19, 2017 18:07 PM

I understand sharing databases/tables is frowned upon as a practice, however, I need to share users and some nodes between two websites. What are the alternatives and what are the pros and cons of the most common strategies?

To give slightly more detail. I need to create a website for "staff and authenticated users" that is separate to a main site that the public anonymously accesses. On this secondary site there will be forums and chat functionality moderated by admins for both sites. I would like to avoid having the admin users re-log in when they are managing the second site.

I also need to allow for some future integration where some "logged in" user content appears on the main site.

Are the two alternatives for doing this only,

  • Make one giant single site
  • Share databases

or is there some other way?



Answers 1


Sharing users can be done by setting up OpenAuth or something like it.

Sharing nodes can be done using views database connector this tool will let you pull data from a table in another database. To make it work for pulling in nodes, create a MYSQL view (https://dev.mysql.com/doc/refman/5.7/en/create-view.html) that holds the node data you need to share out. The views connector will be able to read in that table allowing you to create views from your other server without having to duplicate the content. You can filter on any field in the table. This set up works well for a 1 to Many Content server environment where you don't want to have a new copy of every node on every new install. https://www.drupal.org/project/views_database_connector

You can also create a module that pulls data from the other database and present it any way you want.

If you are fine duplicating the content you may want to explore Drupal aggregation it's easy to set up and can all be done through the UI.

Daniel Lefebvre
Daniel Lefebvre
July 19, 2017 17:14 PM

Related Questions


auto login to only single subdomain

Updated March 16, 2017 09:07 AM

Domain access with access control bridge

Updated November 13, 2016 08:03 AM