Connecting Data to members only

I am trying to create a members only section to my website. When a member signs up they can enter all of their profile information. I currently have the members database setup and users can login and when you click on my profile you can view only your profile data. There is an update button that allows users to then update the profile that works too. My problem is I want to add another collection of data that has a workout and a score that is entered and recorded daily, but I only want the members to be able to see their own workout data. I am having a hard time figuring out if I need a dynamic page or regular page. How does the workout page tie their workouts, scores, and dates to the member profile with the references? I have tried to create a workout table and use the email from the member table as the reference to create a unique ID, but I get and error. If I create a regular page and add a workout dataset to the page, on the preview inside the editor it works, but if I go outside editor on the website itself, it does not change the data in the text field. Any assistance would be fantastic!

1 Like

Hi Matthew,
you can use a standard page with a regular dataset.
you then set a filter to the dataset to only retrieve data that is owned by the current logged in user.

to retrieve the current user’s ID, use the wix-users module.
to set the filter to the dataset, use the wix-dataset module.
the filter should match the logged in user’s ID with the “_owner” field value in your workout collection.
that field always has the ID of the user that created the record.

hope this places you on the right path!

How do I setup the member to be able to add their own workout with a score and date so they can post them daily? I assume I am going to have a separate workout collection that has the workout, score, and date that then needs to be tied to the member collection. I guess what I am asking is how do I setup the collection so that the workout information is tied to the member to then be able to display the information back to them.

1 Like

the system does that automatically for you.
the _owner field gets populated with the logged-in user’s ID whenever a new record is inserted to a collection.

so if your form lets a user submit data to the workout collection, any new entry there will have the logged-in user’s ID in _owner.

you can view the data in the content manager (make sure to display the usually-hidden system fields such as _id, _owner, etc).

hope this helps.

Awesome! I think I am starting to figure this out. I have my profile, workouts and scores working now. When the user submits the score, it is entering a new record in the scores collection. My last issue is how to create a separate page with a table that lists all the scores entered from the scores collection from that owner. Currently when I insert the table I am only able to see the last score entered by the owner in the table. I cannot figure out how to get the other 3 scores to show below in the table. Any advise on this would be great. I tried to create the dynamic page from the scores collection, but I am wondering if I need to create the dynamic page from the workout collection and add the scores dataset to the page?

I think I just figured it out! Thanks.

1 Like

Hi guys,

i am trying to do something similar, but i hv no idea still.
How could i “set a filter to the dataset to only retrieve data that is owned by the current logged”?
The _owner field doesn’t allow to to be filtered in the table, so do i need any coding to filter a variable as the _owner (the member itself?)

Should i use this code?I am not sure what should i type into the xxxxx, since it is a variable. Every owner has their owner owner ID.

import wixData from 'wix-data'; 
// ... 
 $w("#myDataset").setFilter( wixData.filter()
   .startsWith("_owner", "XXXXXXX") 

Hi Matthew, I’m also trying to setup something similar and currently stuck.
Would it be possible for you to share your setup and codes here?

Much appreciated. Cheers

I hope so too!!! We will all be appreciated!!!

Same here… a bit more step by step would be good for this novice

I am still working out the kinks on this, but hope to post a solution soon.

1 Like

great matt… ive been close as well… my system need is similar and ive been trying to figure out how to allow users to edit after they submit while still have the same functionalities that you outline… btw, i used references between collections to call up my datasets in both dynamic and regular pages…

I to have same problem as Matt and others.
But I can’t resolve it with the steps given in the chat, can anybody help please,
You can mail me at
Anything would be great
Anudeep G. :slight_smile:

Hey, go to settings of the dataset on the editor page and set to Read and Write. Then scroll down a little further to “filters”. Add filter and then in the “field” name click arrow and scroll down the list until you get to Owner. Click on “Owner”, leave “condition” as “is”, and “User” should say “logged-in user” . Click “add filter” to save the settings. Now publish site and the front end should only show logged-in user details only.
Hope this helps