Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+10 votes
1.6k views
in Plugins by
edited by

EDIT: Simplified, no need to edit core files, ability to use per-site themes and plugins

I've managed to setup two sites to use the same set of php files.  To accomplish this, here's what I did:

1. Place your source Q2A files in a directory outside of your site root, e.g. /home/me/q2a/

2. Make a new directory somewhere else on your server where your actual q2a site will reside, e.g. /var/www/q2a/

3. Make symbolic links from the source files (not the root directory) to the new directory:

    ln -s /home/me/q2a/* /var/www/q2a/
    ln -s /home/me/q2a/.htaccess /var/www/q2a/

4. Copy the original qa-config-example.php to qa-config.php in the new directory    

5. Edit the new qa-config.php file as needed, using a unique table prefix.

6. Repeat steps 2-5 for each site, making sure the table prefix of each site is unique.

This seems to work with Q2A 1.5 to allow multiple sites to use the same core code, plugins, and themes.  If you want to use unique sets of plugins and themes for each site, just delete the symlink for the qa-theme and qa-plugin directories for that site, and replace them with actual directories with actual plugins and themes.

Either way, it motivated me to network my two sites with the following plugin (note: you don't need to do the above to use this plugin)

 

Network Sites Plugin:

https://github.com/NoahY/q2a-network

 

Features:

- adds individual active site icons and site points to user_meta
- option to restrict "active" to minimum score per site
- optionally shows network points instead of this site points in user_meta
- widget lists all sites in network

 

Front-End Screenshot:

Admin Screenshot:

UPDATE: Added module to migrate posts from one site to another; also migrates children, grandchildren, selected answers, and unsets related questions - highly experimental, use at your own risk!  Screenshot:

Maybe will add more features over time.  Any suggestions?

Q2A version: 1.5 beta 2
by
This could be an incredible plugin. Quick question you say:
"Edit index.php and add the above line there, before the following line:"
require 'qa-include/qa-index.php';

This is a bit vague. Above what line? Before what line?  - do you add the "require line" or is this changed? If so changed to what?
by
you don't need to do the above to use this plugin, sorry if it sounded like you did.  Read the readme at https://github.com/NoahY/q2a-network for requirements.
by
Thanks i will definitely will use plugin in future. Favorited.

As i understand if i'm using plugin, i should not do steps in instructions ?
by
You can, but you don't have to.
by
Hi NoahY ! thank you for the great tip! strangely on my side the index.php symlink looks like a folder shortcut, and it return on actual website "500 internal error...)
do you have any idea please?

2 Answers

0 votes
by
Will this work with the current latest available QA version (1.5.2) or only for the beta version you're currently developing on (1.5 beta 2) ?
by
it should work for any version from 1.5 on.
0 votes
by

This plugin is interesting. I haven't tried yet but I have some questions:

  1. Administration/Moderation is still separated per each site ?
  2. Search is still separated per each site or there is option to global search?
...