Well, for starters, you could add a column to your table that holds the "owner" of the thread. Presumably, the first person to post in the thread.
That gets rid of the need for the code I had to write in post #4, above.
As I noted in your prior thread, doing all this for a *single* userid seems possible. In fact, I think I had the answer for same in that other thread.
Doing it for all users is not so easy.
Where is your priority, here?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.