I’ve been implementing wix-members and wix-members backend on a site where I previously used wix-users. I am happy with new possibilities such as onRegister, but I’m also finding some discrepancies. Hopefully this post can inspire someone working on this API, if they read this.
- I haven’t found a good replacement for wix-users.currentuser.getPlans, so I haven’t been able to fully leave wix-users behind on my website.
- Please consider this other demo site
https://verbaldancing.editorx.io/demosite The status text tells if a user is logged in. If I register/log in, it will show ‘logged in’. But if I then go to the other page, and then back to the main one by clicking on the logo, it will go to ‘not logged in’. According to wix-users I am logged in, but in wix-members I am not.
Hey @verbaldancing
Regarding your issue with getPlans, have you looked at getCurrentMemberOrder it’s probably what you are looking for
For number 2, I can confirm I’m experiencing the same issue.
Thanks Kentin! I have been trying getCurrentMemberOrder, but it was a little confusing. There were some ‘permission denied’ errors if a user wasn’t logged in. I finally got a script working, but I’m still not 100% sure about if it, so I haven’t fully implemented it.
Here’s what I ended up with, anyway.
function getActivePlans ( ) {
return currentMember . getMember ()
. then ( member => {
if (! member ) { return }
return wixPaidPlans . getCurrentMemberOrders ()
})
. then (( orders ) => {
return orders ? orders . filter ( x => x . status === “ACTIVE” ) : undefined
})
}
@verbaldancing I would return []
instead of undefined
Plus, always catch your promises, you need to log error that arise so you can debug your code more easily
@verbaldancing Thanks for letting us know about issue #2. I’ve shared it with the developers and will report back once I have any updates.
I checked with the developer, and the second issue should now be resolved. Please let us know if you’re still experiencing any problems. Thanks!