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

Version: 1.8.0-beta2
Configuration: 3 Q2A sites (1 database, 3 datasets, common users tables):
- http://www.problemko.com/
- http://de.problemko.com/
- http://sl.problemko.com/

User registers on Q2A_1 site, but is not displayed under "Users" on Q2A_2 and Q2A_3 sites, unless:
- User post a question or an answer on Q2A_2 and Q2A_3 sites, or
- Administrator executes on Q2A_2 and Q2A_3 sites: Administration center-Stats -> Recalculate user points

Is it possible to solve this in official release of V1.8?
Thank you very much!
Q2A version: 1.8.0-beta2
In my multiple installation I realized that page /users/new shows all the users, however, the userpoints are set "0" for new users in the main page, but "" (null) in the second page! I bet this is related to this bug.
@q2apro Can you confirm this is the same case Problemko is talking about? Are you using a shared users table and that you are NOT using external users? Can you confirm this is happening in a clean installation as well?
Confirmed. Shared user db. No external users.

2 Answers

+3 votes
selected by
Best answer
Good explanation. I literally guessed exactly where the bug was while I was reading the question.

I've sent a pull request with a fix for this. You can try it out here: https://github.com/q2a/question2answer/pull/605/files

I haven't really tried it much but if, for whatever reason it doesn't work, just roll it back. It won't change any data.
That's because the user doesn't really have any points... in fact they don't even have 0 points, they don't even have null points... they just don't exist :) Every time a piece of code running in a site that is different from the original site the user registered points will not exist. I see two options: run a Cron to synchronize all Q2A installations or check on every page refresh if the points for the logged in user exist and, if they don't, create them as if the user had registered in the site.

The latter is the less awful solution. This one DOES change the database as it creates the missing data so you can actually test once after user creation. The second refresh won't create any record, only the first refresh for a non-origin site. Check the pull request again.
It works! Thank you very much.
I really appreciate your work and I'd be delighted if you register at my site problemko.com.

There is maybe just one minor thing left:
- When admin deletes user on Q2A_1 site, corresponding record in table userpoints in Dataset_1 is also deleted, but not in Dataset_2.
- When admin deletes user on Q2A_2 site, corresponding record in table userpoints in Dataset_2 is also deleted, but not in Dataset_1.
As already said this is minor bug and has nothing to do with my originally posted question and your patch, but it would be nice if somebody fix this to avoid dead data in database.
Thanks. There is no event that can be fired to catch that case because different Q2A sites are unrelated and can't talk to each other. The dead data is really a minor issue. If I remember correctly, that also happens with the words table when posts are deleted. Best way to delete those userpoints table records would be to remove them while performing a database clean-up operation.
@pupi1985: Always nice to see that you fix this stuff where I would be stuck for some hours.
+1 vote
This is known issue, I also mentioned in below thread....I'm also looking for fix in q2a :)