Redirect members after custom sign up

Hi, I want to redirect users to a “Thank You!” page or lightbox after they have signed in. The button that appears in the custom sign up form does not have a link icon that would allow me to add such a redirect, nor does there appear to be a standard automation that would do this so I have added an event handler (See below) - this produces the desired result, but now the user is not shown as logged in after sign up and has to click on the log-in button again. Have I overridden the original event handler?
Thanks!

export function button2_click(event) {

//redirects to thanks page:
[wixLocation.to(“/thanks”);](wixLocation.to(“/thanks”);
})
[}](wixLocation.to(“/thanks”);
})

When you say custom signup, do you mean the Wix Custom Form or have you actually made up your own custom lightboxes for signup and login as this is important to know as the Wix default and the Wix custom signup forms are both still through Wix itself and not really suitable for interjection with code.
https://support.wix.com/en/article/about-the-member-signup-form

If you are wanting to actually create your own custom lightbox for signup and login, then see this tutorial here from Nayeli (Code Queen).
Signup:
https://www.totallycodable.com/wix/corvid/custom-registration-for-site-login-using-wix-code
Login:
https://www.totallycodable.com/wix/corvid/create-custom-log-in-sign-on-screen-using-wix-code
https://www.youtube.com/watch?v=QbH8_eudjbE - youtube video for login tutorial

In your signup code for your lightbox, it would contain these lines…

// rest of code //
wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status");  //Change the URL ending to whatever page you want to send the user to after they log in.
// rest of code //

In your login code for your lightbox, it would contain these lines…

// rest of code //
wixUsers.login(email, password)
   .then( () => {
     console.log("User is logged in");
     wixLocation.to("/account/my-account");  //Change the URL ending to whatever page you want to send the user to after they log in.
// rest of code //

Finally, if you do make up your own custom lightboxes, then you will also need to enable custom signup in your member signup settings, as shown here.
Velo: Enabling Custom Site Registration | Help Center | Wix.com

The links are dead unfortunately, do you have an alternative?

In this demonstration, do you add this code after button click?
If so this may not be very reliable as not all registrations are successful.

Is there a way to execute this code after successful registration?

// rest of code //
wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status");  //Change the URL ending to whatever page you want to send the user to after they log in.
// rest of code //

Here you go bud :slight_smile:

Does anyone know how to do this but for a specific anchor?

What is your current code?

I wanted the SIGN UP (custom) lightbox to redirect to the “Paid Plans” page (https://www.shaktialchemy.co.uk/plans-pricing) but to the anchor I have (ID: membership) which is the location where you see the plans (below the video + text). But no matter what I do, it goes to the top of the page.

I tried wixLocation . to ( “https://www.shaktialchemy.co.uk/paid-plans/#membership” );

My current code is below — I just have it redirect to a members account page now bc I cant figure out how to redirect to the anchor lol

import wixUsers from ‘wix-users’ ;
import wixWindow from ‘wix-window’ ;
import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {

$w ( "#submit" ). onClick ( ( event ) => { 

let email = $w ( “#email” ). value ;
let password = $w ( “#password” ). value ;
let first = $w ( “#fname” ). value ;
let last = $w ( “#lname” ). value ;

wixUsers . register ( email , password , {
contactInfo : {
“firstName” : $w ( ‘#fname’ ). value ,
“lastName” : $w ( ‘#lname’ ). value ,
}
} )
. then ( ( result ) => {
let resultStatus = result . status ;
wixWindow . lightbox . close ();
wixLocation . to ( “https://www.shaktialchemy.co.uk/account/my-subscriptions” ); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );

});

@jessrightdesign
Where is your —>
$w(‘#myElementIDhere’).scrollTo - command in your code?
Also think about a little time-delay?

setTimeout(()=>{ your code here },150);

Of course this code should be on your next site in the onReady-part of the next site’s code.

@russian-dima Sorry, I copied that code via another thread & made my adjustments to it. Im learning code right now but I wasnt aware the scrollTo command was required. If I was to implement it inside my existing code then where would it go exactly?

Also, I’m using Wix CUSTOM sign up & log in forms, not VELO. If that info helps at all.

@jessrightdesign
Almost every element which you can find in the VELO-API has a scrollTo-function.

-Buttons
-Repeaters
-Boxes
-Strips
…and so on…

First ask yourself —> when the scrollTo-function should be activated?
Then find the related code-part for this action and paste the scrollTo function at the choosen place in your code.

More infos about scrollTo you will find here…
https://www.wix.com/velo/reference/$w/button/scrollto

@russian-dima Thanks. Ill take a look and see if it’s something I can understand… but for your info I found the code I listed above here: https://www.wix.com/velo/forum/coding-with-velo/custom-member-log-in-page-redirects-user-to-wrong-page

It works by sending you to a specific page but just not to a specific anchor like I need.

@jessrightdesign Yes i understand. And i also can tell you, that your wished function is not included in the shown code of your example.

How could i know this within just a few seconds?

Here comes the trick…
I told you which code-part is needed to get your wished function to work…
…see here… ----> $w('#myElementID").scrollTo().

Now how to know if the example offers you this functionality?

YES OF COURSE —> You use the F-Searchfunction in your BROWSER.

Press —> CTRL+F → a SERACH-POP-UP-WINDOW will open.

Type in —> “scrollTo” take a look onto the related CODE. Did the Search-function find some results? If not, then your choosen example also do NOT offer the → "scrollTo()-functionality, right?

What next?

Yes, exactly—> now you go back to the VELO-API-Docs and read this part here…
https://www.wix.com/velo/reference/$w/postpage/scrollto

…and here…

https://www.wix.com/velo/reference/wix-window/scrollto

Heyyyy! You just found two different ways, how to solve your problem, right now.

Now please take some time to understand the shown code-examples.
Than do some testings. Take your time and do not give up after 3-attempts.
A good CODER, do NEVER gives up!:wink:

I will give you an example on my own experience…
I am still not a VELO-Master and still have to learn things like you and sometimes get into situation, where i can’t find solution and almost think about to give up.
But on the next day, i just try it again & again & again & again & …yes and again, till i get my result.

And yes, sometimes a little HELP is needed, just some hints, should be enough.

Perhaps your question now will be …“What are you talking about all the time?”

See here my own experince …
https://www.wix.com/velo/forum/coding-with-velo/how-to-upload-from-buffer

At the beginning i even wasn’t able to generate a normal upload, now i am able to generate a MULTI-UPLOAD, something what is normaly still in developement …
https://www.wix.com/velo/wishlist?origin=menu

With enough of effort you can do everything in VELO, even if it seems not to be possible!

Good luck and happy coding!:wink:

By the way… here you can also find some interessting example…
https://russian-dima.wixsite.com/meinewebsite

take a look onto it, i am sure, one of these examples coulld lead you to your solution.

I am not a developer, nor do I know code. So my question is this…
Wix has created a Default Site Member Plug In. That plug in has a default signup and sign-in plugin that SHOULD integrate with the Default Site Member Plug In…But after a New Member or a Returning Member login, Wix does not provide “Me” with the option to link the “sign-up” or “log-in” button to a specific “general page” or “member page”.

That seems silly.

I would expect that after a member logs in or signs up, it would only be logical that they would be redirected to “some other” page. Or at least a page of “My” choosing.

Can someone help?

Just like any other Wix Button, I would simply like to apply a link.

Thoughts?

Please open a new OWN-ISSUED-POST, this one is already a little bit OLD.
Describe your situation as detailed as possible.
Screenshots of used DBs and elements are usefull.

You can link this post with your new one, once it is created. :wink:

Never tried to use the already given “out-of-the-box” Login-Page of wix and modify it.
But what is surely possible is, to redirect from own custom created Login-pages.

Code will be needed.

Example… read this …
https://www.wix.com/velo/forum/site-page-design/custom-login-page-1

@joseph72670 I 100% agree!!! That’s what I’m searching for today! Why not just give us a LINK that we can attach to a button that sends them through the SIGN UP/LOGIN + PAYMENT process and then get to choose where they get sent after they sign up? Why on earth have a sign-up for members that sends the members (AFTER PAYING AND SIGNING UP) to the homepage? Why not send them to the paid content or where we choose?

@rc-powers Hmmm, i see very often this issue. Perhaps i should integrate this functionality into my Login-Management-System aswell.

What about—> user have options to do a setup in the settings, where they can place several URLs and can choose an URL from that dropdown.

I will come back soon, to show a possible solution.

@russian-dima If you get something working, I’d be highly interested!

@russian-dima I’m not sure how this can be “old”… It was originally posted on August 14th, 2021…