Hi Mike,
While using lightbox as your own form its supposed to replace the wix default login page.
Instead of using the regular the wix default login page, you can create your own customized login form.
It lets you to create your on login and signup form without limitations, but still allow you to save your new member at the wix- crm module. Moreover, you can use all the wixUsers functions.
Here’s an example of a signup and login form with code snippets:
1 . Add a lightbox, the signup and the login buttons. Afterwards, add the following code:
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
export function signUp_click(event) {
//example of fields
let email = $w('#input6').value
let password = $w('#input10').value
let firstName = $w('#input4').value
let lastName = $w('#input5').value
let phone = $w('#input7').value
wixUsers.register(email, password, {
contactInfo: {
//all the fields beside email and password
"firstName": firstName,
"lastName": lastName,
"phone": phone,
}
})
.then((result) => {
let resultStatus = result.status;
wixWindow.lightbox.close(); // don't forget to close the lightbox
});
}
- Connect your lightbox to one of your pages by entering to the
“Member signup settings”-> “Edit custom signup” → at the fields “What does it link to” choose the desirable light box. It’s a one-time action that you can do on any member page.
3.Add a logIn and logout buttons to your home page (or any page that is going to be the entry one).
The login button’s event is going to open the lightbox.
4.Add an event handler that runs when the buttons are clicked and add the following code:
import wixWindow from 'wix-window';
export function logInButtton_click(event) {
wixWindow.openLightbox("sighUp").then(() => {
console.log("login succeed");
})
}
export function logout_click(event) {
wixUsers.logout();
}
Obviously, you can change the lightbox and the buttons as you wish. That’s the advantage of using a lightbox as your own login and signup page.
Have a nice day and best of luck!
Sapir
