Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+7 votes
in Q2A Core by
"u_register" event can be used to identify a new user registration. But when we use shared qa_users table and user is already registered on a network site is there any event which we can rely on to know if a user is using the current site for the first time?
Q2A version: 1.8.6

1 Answer

+1 vote
selected by
Best answer

Each site is independent, so there is no way of firing an event in one site and receiving it in another. I can only think of two approaches (none of them thought in depth):

  1. Track in a custom shared table "if a user is using the current site for the first time". I'm quoting because you will have to define what "using" means (e.g. is accessing the homepage a way of "using"?). So all sites would listen to the "using" event and check the table when this happens. You can store this value in a session so it doesn't hit the DB that much.
  2. I might be wrong, but I think this line, is executed only when the site tries to access logged in user information and the ^userpoints record is not there. Considering the ^userpoints record is created when the user registers, it seems fair to assume each time that line is executed, the user has been previously created in another site and that it is the first time that this user is requested their information in this site. So you can either add your code there or fire a custom event.
Thank you @pupi1985. That's exactly what I wanted -- event when a user gets first point in a network site.