I have created a collection for the games, one field is the email of the owner of each game
I have created a page to display all the games of the current member, my purpose is to filter on the email field. I have to retrieve the mail of the current member.
I am not expert in javascript and velo wix, although I have used it already for a few things.
So I’m trying with
import { members } from “wix-members.v2”;
and
const member = members.getCurrentMember() ;
But after that, I don’t know what to do just to retrieve the mail address of the current member.
Thanks so much for helping me if possible.
Isabelle (sorry for my desperately approximate English)
A. For readability, please format your code like so:
For inline code use `code`
For multi-line code, use:
```js
yourCode() {
here
}
```
B. wix-members.v2 is still in beta, so I recommend using wix-members-frontend
import { currentMember } from "wix-members-frontend"
// asynchronous function, gotta wait for it to return the results
currentMember.getMember().then(member => {
})
C. You have set a constant member, and want to check what it contains, you can access its properties using member.propertyName or member['propertyName']
You can see the various properties returned by looking at the documentation for the method you’re executing:
In this case, the field “owner” has been created after the dataset initialization.
When I create my dataset, the system field “Proprietaire” (that’s to say “Owner”) has been created, but it doesn’t contains the email, it contains a code, not usable.
How can I have this precious field which makes automatically appear “Logged-in user” in the filter?
Every item automatically gets an “owner” field. The “owner” is the person that is logged in that entered the item into the database. So if YOU are the one entering all the data into the database, then YOU are the owner of that data. You are the “Author” basically.
You cannot assign it to anyone else.
If you want the Member to be the owner of the field, then they need to be logged in and they need to insert the data into the database themselves.