Edit the standard Wix new user form ?

This signup process seems to work well enough - but I need to get another field into the standard signup form. Does anyone know of a way of adding additional fields into this form ?

You can create your own custom signup page with as many fields as you want, just create a new page and use the code below:

import wixUsers from ‘wix-users’;
import wixLocation from “wix-location”;

$w.onReady( function () {

        $w('#SignupRegisterButton').onClick(() => { 


                       wixUsers.register($w('#SignupEmailInput').value, $w('#SignupPasswordInput').value, { 

“contactInfo”: {
“firstName”: $w(‘#SignupFirstNameInput’).value,
“lastName”: $w(‘#SignupLastNameInput’).value,
“gender”: $w(‘#SignupGenderInput’).value,
“dob”: $w(‘#SignupDOBDatePicker’).value,
“password”: $w(‘#SignupPasswordInput’).value,
“favoriteColour”: $w(‘#SignupColourDropdown’).value

                                } 
                            }) 

                            .then(() => { 
                                console.log('user registered successfully'); 
                                wixLocation.to('https://google.com'); //change this web address to your login page or home page 

                            }) 
                    } 
        ) 

})

1 Like

Mike,

Thanks for the response. One of the reasons I just wanted to add a field to the standard from is it all works well - but just does not collect a vital bit of info to make it useful.

The other reason - I have tried my hand at some code and have been battling to get it to run - and cannot find any sort of log to show me what happened. I will take a look at your code and try and understand it.

at the risk of forking this post - my code is below. If you can spot anything obviously wrong would be appreciated. The url is https://ross9756.wixsite.com/cactii/signup-3. The page saves info to the dataset. It does not save it to the CRM contacts, does not get the contactID and does not send an email.

export function button1_click(event, $w) {
wixCRM.createContact({
“First Name”: $w(“#input1”).value,
“Emails”: [$w(“#input14”).value],
“Last Name”: $w(“#input2”).value,
“Phone”: $w(“#input15”).value,
“Street”: $w(“#input8”).value,
“City”: $w(“#input10”).value,
“Zip”: $w(‘#input15’).value,
“Country”: $w(‘#input13’).value,
})
.then((contactId) => {
wixCRM.emailContact(“Verify”, contactId, {
variables: {
subscribername: $w(‘#input1’).value,
}
})
.then(() => {
// do something after the email was sent
})
. catch ((err) => {
// handle the error if the email wasn’t sent
});
});

}

1 Like

Hi Mike,

Could you please advise how I am to deploy the custom signup page code? Does it have to be dynamic page? Or just a standard page with user input fields connected to a dataset?

I would really appreciate your guidance here; I am quite unfamiliar with Wix code and dynamic pages

Just a standard page with user inputs. Note the code i gave above registers users via the wix crm. Open your wix dashboard and click members, you will see a list of registered members there. For this method you do not require a dataset or database. The member details are stored on wix crm.

1 Like

Thanks Mike! It does appear in my CRM.
If its not too much trouble, could you assist me in how I might change the code so that new users can sign up, but need to be manually approved before access is granted? I would need to be notified of sign-ups for approvals(i assume you would use trigger emails for this).

Also, I don’t suppose you have the custom login page code to follow-up from this registration page?
I’m really rushing through this, and appreciate all the help you can provide

You can change to manual approval required for all members in your dashboard

For your custom login page use code below…

import wixUsers from ‘wix-users’;

let email = $w(“#email”);
let password = $w(“#password”);

wixUsers.login(email, password)
.then( () => {
console.log(“User is logged in”);
} )
.catch( (err) => {
console.log(err);
} );

Thanks so much for your assistance! It worked out well.
But after a couple of success, I encountered: Uncaught (in promise) Internal Server Error (500) error.

Is it a random issue, or have I messed up something?

Am using code for registration:

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
import { session } from ‘wix-storage’;

$w.onReady( function () {
$w(‘#submit’).onClick( function () {

     wixUsers.register($w('#email').value, $w('#password').value, { 

“contactInfo”: {

“firstName”: $w(‘#firstname’).value,
“lastName”: $w(‘#lastname’).value,
“company”: $w(‘#company’).value,

    }})  
        .then(() => { 
                console.log('user registered successfully'); 
                wixLocation.to('/about');}); 

});
})

export function submit_onclick(event) {
wixLocation.to(/projects);
}

500 error is a very generic error code, it can mean that there is a problem on server side. Contact support@wix.com if the error code persists