(SOLVED) Custom registration

Hi,

Do you have an idea about how to get a newly registered user into a Members database?
With the code below, the user is registered as a user/visitor only …

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';

$w.onReady(function(){  
    $w('#register').onClick(function (){    
 let email = $w('#email').value; 

 let password = $w('#password').value;   
        wixUsers.register(email,password)   
        .then(()=>{
        wixLocation.to(`/Members/${wixUsers.currentUser.id}`); 
            })
        })
    })

Any idea, how to edit code that will add user/visitor into Member database?

Thank you for any advice,
Jakub

Have a read of the Wix Users API and the register function as it gives a sample code that you can look at.
https://www.wix.com/corvid/reference/wix-users.html#register

Wix do a tutorial for a custom signup form here.
https://support.wix.com/en/article/corvid-tutorial-creating-a-custom-registration-form-with-code

However, you will probably be better off looking at Nayeli (Code Queen) tutorials here as they will explain in more detail to you
https://support.totallycodable.com/en/article/custom-registration-for-site-login-using-wix-code
https://www.youtube.com/watch?v=QbH8_eudjbE
https://support.totallycodable.com/en/article/create-custom-log-in-sign-on-screen-using-wix-code

When you do your own custom lightboxes you will need to change the member signup settings too.
https://support.wix.com/en/article/corvid-enabling-custom-site-registration

Plus, that Wix location link - wixLocation.to(/Members/${wixUsers.currentUser.id});
That is for when you have made the Members Profile as in this tutorial here
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

Fast support as always. Thanks!

Well, I checked all related links, and none of them solving my situation.
Nayeli’s video is cool, but she doesn’t use her own member’s database.
So far, I tried to combine my code with the one mentioned in the last link but without success.

@jakub
You won’t be able to do that.

When a user registers on your site to become a site member all their details of email and password are saved into the Wix CRM and you can see their email on your Contacts List in the Wix Dashboard.

If you want to have a separate members dataset, then you need to do something like that members profile tutorial.

This works perfectly for me and closes after registering details before moving users onto a signup status page, then both names will be saved in Contacts and once site member is manually approved the member details will be added to ‘members’ database which is from that same members profile tutorial.

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   let email = $w("#email").value;
   let password = $w("#password").value;
   let first = $w("#firstName").value;
   let last = $w("#lastName").value;

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  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.
      } );     
    } );
    
});