ok, the php problem was solved, it was a matter of checking if the $user variable was empty
but the function is still very slow. is it a problem of the for loop?
can the function be executed after the topic page is refreshed?
any other ideas/suggestions?
thanks