XF 2.2 Piece of data persisting from guest session to user session


Well-known member
Figured it would be easy enough to ask the question in case there's a built-in mechanism to retain something from a guest session to a logged in/registered user session.

Currently I'm grabbing the existing session variable I stored within the XF\Session\Session::changeUser() method (before $this->regenerate(false)), then add it to the new session after $this->regenerate(false) is called. Not trying to call $this->regenerate(true) (keeping existing data, although it does appear to work) because I don't know what the ramifications are of keeping all the session variables that I don't care about.

Just wondering if there's a better way to do this without needing to extend the Session class, or if I'm going about it the best way.