Hey everybody,
I have a problem with creating a custom interaction which is supposed to assign a role (which is required to access a restricted page) to a user who just purchased a membership.
After the user gets redirected to my “thank you” page from a 3rd party provider he can have one of 3 status – logged in, registered (but not logged in) or a completely new user.
I want the user to enter his mail and password into input fields
The code then needs to check whether the user is currently
- Logged in
- Registered
- A new user
Then the user would click the “get access” button. OnClick the code needs to
- Add the specified role to the user
- Login the user AND add the specified role to the user
- Register the user AND add the specified role to the user
In the end, the user should be forwarded to the access only page.
I would appreciate your help as I am a total beginner with Velo. I somehow manage to get individual pieces of code to work (login, register and adding role to users). However, I cannot manage to combine them into one working code and the initial check for the user status is out of my league.
Thanks in advance
JP