Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
669 views
in Q2A Core by
edited by
Hi,

Ive managed to get two Q2A sites running on the same user base by having qa2_users being a view of qa1_users (same for userpoints and userprofile). However when someone creates a new account on either site, the number of users doesnt update on the other site untill you do a "Recalculate user points" in the admin panel. How to fix? Any ideas?

1 Answer

+1 vote
by
 
Best answer

First of all, nice catch!

Second, the way to fix this is to modify function qa_db_userpointscount_update() in qa-db-points.php. This is called to update the count of users whenever necessary. You want to add another line in there that updates the same row in the qa*_options table for the other Q2A installation.

by
thnx for the answer but I am abit confused. The function now has the following line:

qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_userpointscount', COUNT(*) FROM ^userpoints");

(for site no1)

the table for site number 2 options is called qa_ace_options. What would the second line in the function be?


qa_db_query_sub("REPLACE qa_ace_options (title, content) SELECT 'cache_userpointscount', COUNT(*) FROM ^userpoints"); ?

And reverse in the qa_db_userpointscount_update of site2?
by
Yes, that looks right.
But actually I just realized you can't really share the userpoints table, since this is calculated based on activity in the separate installations when updated. So I recommend having separate points for the two installations. You should still be able to share the users and userprofile tables.
by
seems to be working :) thnx! More questions coming soon :)
...