Connecting Member Login To Dataset

I have created a membership dataset and want to use that for login. I created a Member Login and moved to the header. I clicked settings and connected it to my database with text connected to email. When I test nothing happens. Do I needs some wix code to make this work?

Wix Code is simple, but it’s not THAT simple)
Please check this article to create membership pages:

What are you trying to achieve?

I will have a number of protected members only pages within the site. Therefore, I need a member login.
I saw the article. I dont need that right now. I just need to validate the member.
I REALLY need the paid membership since our members pay dues, but that is supposedly coming later.

Thanks Mikhail.

Then you don’t need wixCode. You create member login button anywhere (for example, in header or home page)
And then protect any page with memeber access only. Here:
https://www.screencast.com/t/97scmsy5p
https://www.screencast.com/t/6UPJVQGE3Ajy

Yes Mikhail. I had done that before I connected the member login to the database. Here is the scenario.
Anyone can visit our site and browse public pages. If they decide to join there is a JOIN link that shows an application form that is connected to our membersship database that I have already created. It has 20+ fields of data. Once they join and pay the membership dues via PayPal, an administrator will approve the application. I see that I can set the approval by an administrator. What is not clear to me is how do I use MY database for the email/password login.

" What is not clear to me is how do I use MY database for the email/password login. "

If you want to store emails of users in your own database, you should read the article and create login button as described there.
Otherwise, with membership button from Add Panel, you can’t store users in your collection

Note that you can’t store passwords, they are still stored in general login system of Wix

I have the login successfully implemented using the Article mentioned above. Thanks for the help!
JD

You’re welcome)

Hi, can you guys help me with something ?
i’ve created page that has input fields of ID and Password. i’ve also created a data collection “Members” that has the fields ID and Password. what i’m trying to do is give only login access to who puts information that is compatible with the information in the data collection. how can i do that ?

hi guys

i need help on creating private members pages - i sell furniture and want each client to log in and only access his catalogue.

i am so confused and this tutorial isnt helping me!

Hi,
Which part in confusing ?
Can you explain ?
Roi

Hi Roi

i followed the tutorial by Code Queen Nayeli last night and managed to get it right. i have no coding experience so need help with the next bit.

i want to create a catalog of furniture for my clients. Essentially, they will log in, see their profile and i added a button saying my portfolio.

When they click on my portfolio, i need this to be personalised.
If the first name or ID matches, show them their catalog.

Right now it shows everything across different profiles.

Can you help?

Hi,
My suggestion is to manage 2 database collections. one for member and the second for furniture.
Create a new field in the members collection that stores the ids of the furnitures of the user.
In the Dynamic page you need to get that field with the ids and fetch it from the furnitures collection to a repeater.
Some coding skills are required in order to make it done.
Feel free to paste your code below to consult.
Good luck!
Roi

Can you help me with the members logout…
Link: https://www.wix.com/code/home/forum/questions-answers/problem-when-users-logout

Hi Roi

Thanks I’ll play around with it tonight

I have a question - can you link a url to the original database? And then run a code that says for current user return the url?

I thought an easier way would to be create the gallery page as per normal but hide it so it’s not seen.

But then in the database, under the member information, add their specific galley url. And then run a code to instruct the site to return this url when clicking on my profile.

Does what I say make sense?

Hi there,

anyone could help me please, I have followed how-to-create-member-profile-pages-with-wix-code tutorial and the login button is working fine, but I want that when the user enters it goes directly to the dynamic page. but I always have this error.

error 404

There’s Nothing Here…

We can’t find the page you’re looking for.
Check the URL, or head back home.

this is the code
SITE TAP

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

let userId;
let userEmail;

$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w(“#loginButton”).label = “Logout”;
}
else {
$w(“#loginButton”).label = “Login”;
}
} );

export function loginButton_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#loginButton”).label = “Login”;
} );
}
// user is logged out
else {

// 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"; 
    **wixLocation.to(`/Members/${wixUsers.currentUser.id}`);** 
  } ) 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

How can I change the lang. of the members login code to Portuguese instead of the default English login?

I followed the same code above which was posted by a lady in youtube. It works.
However, when I login through wix and run the code in preview.
It first mentioned that I “login”. I guess it is because I have the role of administor of wix when I login.
When I press “logout” . The system generated the following code.
Unhandled promise rejection No member is logged in.
This does not happen if I visit my site as visitor or through my mobile. The code is Ok.
Can the Wix editor make any suggestion?

Hi!

I lack some basic features in Wix member and Wix forum, such as members can send messages to each other. That members may have different permissions etc. That web-admin should be able to customize the content and function of a specific member or member-group. Is there any plans for this?
I want to be able to sync members and password from my own database, not from Wix login.

Regards/David

Hi Roi,

Wondered if you may be able to help me with this. I am desperate to get this set up through wix so I can manage things myself rather than go for a paid third party system. Makes complete sense to me as the wix members areas are so well integrated. I am just struggling with getting members pages personalised per member. By the sounds of it your solution of referencing a second database on a dynamic page linked to the members login that is only accessible through the generic wix members page.

Let me know if you can help, total noob here but willing to learn!

Thanks,

Dom