How to redirect a new member to the member profile page to fill out the rest of members info?

Hello,
How can I redirect a new member by sending him to the member profile page, so that he can finish filling out the rest of members information that’s asked?

The code I’m using is the for the Wix Support Page " How to Build Your Own Members Area Using Code ".

Link: Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com

This would be a huge help, thanks for you’re time.

Hello

after you promote login redirect the user to the members profile using wixLocation.to() .

Best
Massa

Does somebody has the code for this?

Assuming that your user can successfully log in from a button click of your login form, you need the following code:
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
import wixData from ‘wix-data’;

$w.onReady( function () {
//TODO: write your page related code here…

});

export function button1_click(event, $w) {
//Add your code for this event here:

console.log(“about to login”);
var email = $w(“#email”).value;
var password = $w(“#password”).value;

wixUsers.login(email, password) // login the user
.then( () => { // this .then is important as it’s the PROMISE to go to once the login function has completed
//if(wixUsers.currentUser.loggedIn) { // check to ensure successful login

console.log("User is now logged in"); 

wixData.query(“Members”) // we now query the new Members collection passing in the email address
.eq(“email”, email)
.find()

.then( (results) => {
let firstItem = results.items[0]; //see item below
console.log("url = " + “/Members/” + firstItem._id);

wixLocation.to(“/Members/” + firstItem._id); //page name

} )
. catch ( (err) => {
let errorMsg = err;
console.log("errorMsg = " + JSON.stringify(errorMsg));
} );

}). catch ( (err) => {
let errorMsg = err;
console.log("errorMsg = " + JSON.stringify(errorMsg));
} );

} // end of button1_click function
I hope this helps! I’ve copied and pasted this but removed some code so hopefully it will work ok for you.

Stuart.

Or you can take a different approach, watch my video to find out: Create Member Website with Different Types of Members - Build Profile Page - YouTube

The way that I filled out the profile information was to create a register form with email and password, but also containing the additional fields required in my Members collection. Clicking on the Register button lets Wix handle the initial registration, particularly the password encryption, but then additional code populates the Members collection if the registration was successful. On my site the member is automatically approved as part of the workflow. I could have added logic to determine if the Member had been approved but didn’t feel it necessary.

The following code shows how to do this:

import wixUsers from ‘wix-users’;
import window from ‘wix-window’;
import wixData from ‘wix-data’;

$w.onReady( function () {

/********************

  • client-side code *
    ********************/

$w(‘#button1’).onClick( () => {

wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“emails”: [$w(‘#email’).value]
}
}).then( (result) => {

var newMember = {
title: $w(‘#title’).value,
firstName: $w(‘#firstName’).value,
lastName: $w(‘#lastName’).value,
email: $w(‘#email’).value,
phone: $w(‘#phone’).value,
about: $w(‘#about’).value,
dateJoined: new Date()

};
wixData.insert(“Members”, newMember). catch ( (err) => {
console.log(“error inserting into Members collection” + err);
} );

}). **catch** ( ( err) => { 
    console.log("error when registering new member " + err); 

});
});
})

I hope this helps someone!

This is how I do it:

Using your form’s “Thankyou for submitting” message. Add the below code to your sign up page/lightbox

import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {
$w ( “#iSubmitText” ). onViewportEnter ( ( event ) => {
wixLocation . to ( “/your-desired-landing-page” );
});
});

Hope that helps - I am only 4 years too late lol