Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by

For multiple Q2A installs, with sharing the same WP users database I would like to share as well the qa_options and qa_widgets tables.

The first idea is to actually for each copy to create a VIEW with is extracting the data from initial install qa_options and qa_widgets. This is supposed to work as long I am updating the options from the initial install ?. The frontend is updating the qa_options and qa_widgets or just the backend ?

Second option I see (bettwe I would say) is to make sure from code are accessed the same table (so is ignoring the prefix set for each install). Where I can set this ?
I would be interested to. And by the way it is possible to share also the user activities? So to able to show a global user ranking ...per example...

1 Answer

+1 vote

I think that the easiest would be to edit the core.

Go to /qa-include/qa-db.php  >  function qa_db_add_table_prefix()
And add this code just before the line  "return $prefix.$rawname;"   :

if (strtolower($rawname) == 'options' || strtolower($rawname) == 'widgets')
    $prefix = "your_common_prefix";


you think doing this could compromise future updates?

and for sharing themes and plugins is changing qa-base.php like this fine?

    define('QA_EXTERNAL_DIR', QA_BASE_DIR.'../../qa-shared/qa-external/');
    define('QA_INCLUDE_DIR', QA_BASE_DIR.'qa-include/');
    define('QA_LANG_DIR', QA_BASE_DIR.'../../qa-shared/qa-lang/');
    define('QA_THEME_DIR', QA_BASE_DIR.'../../qa-shared/qa-theme/');
    define('QA_PLUGIN_DIR', QA_BASE_DIR.'../../qa-shared/qa-plugin/');
Any editing of the core certainly CAN cause troubles if you will try to upgrade Q2A to newer version later on.
You will have to compare the differences manually (using free compare tools, e.g. TortoiseSVN).
What is more, from version 1.5, Q2A will be put on GitHub repository so it will be easier to merge your changes with later Q2A versions.
I tried your trick it works!
Also tried mine... It doesn't  :( ... or better it works beside that it inserts a dot in css and javascripts like:

<SCRIPT SRC="./https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" TYPE="text/javascript"></SCRIPT>


<LINK REL="stylesheet" TYPE="text/css" HREF="./qa-theme/mytheme/qa-styles.css?1.4.3">

and can't figure out why...