views:

11

answers:

1

This is a general question, or perhaps a request for pointers to other open source projects to look at:

I'm wondering how people merge an anonymous user's session data into the authenticated user data when a user logs in. For example, someone is browsing around your websites saving various items as favourites. He's not logged in, so they're saved to an anonymous user's data. Then he logs in, and we need to merge all that data into their (possibly existing) user data.

Is this done different ways in an ad-hoc fashion for different applications? Or are there some best practices or other projects people can direct me to?

+1  A: 

If very much depends on your system ofcourse. But personally I always try to merge the data and immediately store it in the same way as it would be stored as when the user would be logged in.

So if you store it in a session for an anonymous user and in the database for any authenticated user. Just merge all data as soon as you login.

WoLpH