Hi Rachel:
The trick is to ignore the section about logging in because you have to create your own log in page.
Basically what you want to do is intercept the page request and examine the fields you use from your own login form to manage access.
So one approach would be to use lightboxes.
Design all of your member only pages as light boxes. This way when your page loads you have control of when a lightbox loads and if it loads.
The other thing you will need to do (which wix handles for you with wix-users) is remember that the user is a member. Depending on what you are trying to do you will probably need to keep a cookie with information that you can use to determine if a visitor has registered. This means you will probably need to use wix-storage (wix-storage-frontend - Velo API Reference - Wix.com) to save some unique information such at the Member record _id from the data collection. So if they have visited your site and ‘logged in’ before you take their information store it in the member data collection and then save the record id in a local store key value pair. Whenever you load a new page you can then check the cookie using wix-storage to see if the id is there. If not you show them a login screen and if the record they try to login with doesn’t match any record in your data collection then they need to register.
So when your special pages load you have a check in the $w.onReady() function that uses wix-storage to look for a membership token cookie.
if you don’t find a membership token cookie then you can launch a login lightbox page using wix-windox.openLightBox function (https://www.wix.com/code/reference/wix-window.html#openLightbox to ask the user to log into your site. If the login credentials match a Member record then you save a membership token in local storage using wix-storage.
If the login doesn’t find a member record then you need to have the user register as a member.
If you find a membership token cookie you look for the membership token in your member database (I would consider doing this in backend code). If the token matches a member database record then you launch the target lightbox using the wix-windox.openLightBox function (https://www.wix.com/code/reference/wix-window.html#openLightbox).
If you don’t find a member record that matches the member token cookie data then the membership data may have been deleted or the cookie data could be fake. Either way you need the user to register again.
Typically this is the functionality you would put in a router (wix-router - Velo API Reference - Wix.com) but this would be more complicated as you need to load a page to be able to read the cookie data. Routers run on the server before a page loads and makes decisions that determine what page or error message should be returned to the user. Technically you could redirect the router to a cookie reader page that doesn’t load content but merely reads information from cookies and then uses wix-locationto() to redirect the original call with added query parameters from cookies to the router.
I may have overloaded you with data here. There are many different approaches you can take but they all need you to remember the user after they register with you and login at most one time per visit (session) to your site. Otherwise they will likely get frustrated.
Lastly, make sure you are recording the visitors permission to record cookies during registration (that’s a legal requirement).
Hope this helps!