Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

MySql VIEW table for single sign-on no update

+1 vote
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?
asked Feb 14, 2011 in Q2A Core by Soul_Assassin
edited Feb 15, 2011 by gidgreen

1 Answer

+1 vote
 
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.

answered Feb 15, 2011 by gidgreen
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?
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.
seems to be working :) thnx! More questions coming soon :)