Hi. I have a database on my site with userId as the key which is used to display a client profile page. Currently when a user logs on, if there is no entry for them on the database, it is added.
However, I want to pre-populate some of the details on the database at the time of approving the user, so that it is shown on the profile page as soon as they log on. This is information which the user wouldn’t know at the time of sign up; for example account number, and is not data they would ever edit - it’s purely displayed to them for information purposes.
I.e. I receive a notification that the user has signed up and is waiting for approval. I access the database and add them directly with the default information. I then approve them, they logon for the first time and their profile is setup.
Is there anyway to do this?
Many thanks in advance.
This is the code for my custom signup lightbox.
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.
} );
} );
});
This works perfectly and closes after registering details before going to sign in status page, then both names will be saved in contacts and once site member is approved the member details will be added to my ‘members’ database.
This is great. Thanks for your help!