Custom Log in and Custom Profile

I’m building a Member site that has a unique sign up that holds Members for approval. That part works with the Wix member database. I now need to build a dashboard for members to update a very long member profile with multiple (+23) fields. I’ve built a new database for all this information which works perfectly. I can use the code below to build the dashboard but I need a “custom” log in because they should not be allowed to “set up” a new account - only log in. I can’t seem to find a way to insert a custom log in to this type of page. I’ve built a Lightbox custom log in but then it won’t work with a page where they can update the new Member database I built - only the existing Wix account member database.

export function loginButton_click(event) { 
 // user is logged in
 if(wixUsers.currentUser.loggedIn) {
 // log the user out
    wixUsers.logout()
      .then( () => {
 // update buttons accordingly
        $w("#loginButton").label = "Login";
        $w("#profileButton").hide();
    } );
  }
 // user is logged out
 else {
 let userId;
 let userEmail;
 
 // prompt the user to log in 
    wixUsers.promptLogin( {"mode": "login"} )
      .then( (user) => {
        userId = user.id;
 return user.getEmail();
      } )
      .then( (email) => {
 // check if there is an item for the user in the collection
        userEmail = email;
 return wixData.query("Members")
          .eq("_id", userId)
          .find();
      } )
      .then( (results) => {
 // if an item for the user is not found
 if (results.items.length === 0) {
 // create an item
 const toInsert = {
 "_id": userId,
 "email": userEmail
          };
 // add the item to the collection
          wixData.insert("Members", toInsert)
            .catch( (err) => {
              console.log(err);
            } );
        }
 // update buttons accordingly
        $w("#loginButton").label = "Logout";
        $w("#profileButton").show();
      } )
      .catch( (err) => {
        console.log(err);
      } );
  }
}

You seem to be confusing yourself.

You only have the one login and register option that saves the users info into the Wix CRM and also displays some of their details in your Contacts list in your Dashboard, along with any custom fields that you have added to your Contacts and the signup form.

I myself have custom login and signup lightboxes and I’ve also used the Members Profile Page tutorial code that you’ve posted above as a basis to work from for my Members Only entry page.

What you have to remember is that the Members dataset that you create in this tutorial is the collection that will hold all the users inputs from their profile page.

It is not a seperate dataset that you can use for login and signup options.

All this dataset does is to show the member user their details on their own profile page and if the member user wants to add or edit anything on their profile page then they click on the update button which will take them to their other dynamic page which is their update profile page.

Here they can add or edit any user input that you let them and when they save or submit these changes, it will be saved back into the members dataset and the member user will be taken back to their own profile page which will now show then their updated changes.

Basically, on the member users first view of the profile page, this profile page for each member will only contain the info that you collected in the signup form for them.

So if it was just first and last name and email and password, then only first name and last name will show if you’ve setup the user inputs for them.

The email and password will be saved in the Wix Crm and not displayed here.

So you need to have elements on your profile page that you want your members to be able to see and change on their profile update page too.

So you add your 20+ user inputs on the member profile page and connect them to the members dataset on the members profile page.

This will only display what the members have added themselves, so expect everything apart from name to be blank as the members dataset fields will be empty.

Then the member user can go to their update profile page where you will have the same user inputs setup, however on this page they will setup so that the member user can edit their name, add an address and email address for mailouts, choose options from a dropdown list or radio buttons etc.

Then when the member user submits these inputs they will then be saved into your members dataset into the appropriate fields and when the member user gets taken back to their own profile page again, as the member dataset now has those blank fields filled in, it can now also display that info on the members profile page.

You can still query this members dataset or the Wix CRM or the Wix Members app PrivateMembersData collection if you wish.

Hi