verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

Guest lists not saving to user account once they have signed up #94

Closed iamtompickering closed 2 years ago

iamtompickering commented 2 years ago

Description

I'm trying to get Wishlists that are created by guests to become assigned to their user account once they have signed up.

Am I right in thinking this should happen using the sessionId?

If so, from testing in an incognito, I can see the craft sessionId in the cookies was logged as ee3dfe1430l6enn6q4av16mlit and then the wishlist sessionId was created as c5c830c6e6c8e6f9b0ab4a54e7733037?!

Additional info

engram-design commented 2 years ago

Yep, it should take guest lists and attach them to your account as soon as you login. It's indeed via the sessionId which shouldn't change when you are a guest to being a logged-in user.

The sessionId value will always be a random number, and separate to the Craft sessionId https://github.com/verbb/wishlist/blob/craft-3/src/services/Lists.php#L198

I'm guessing it's not working?

iamtompickering commented 2 years ago

@engram-design ahh okay, yes unfortunately it doesn't look to be working.

As you mentioned on discord, I've tracked the new Wishlist being created in the DB and it has a random string for the sessionId and the userId is set to null. But then when I sign up for an account and login (all in the same browser and window, so technically should be using the same sessionId), it doesn't update the userId for the Wishlist.

One thing to mention is that users require verification, so not sure if this could be affecting it?

engram-design commented 2 years ago

Fixed in 1.4.10