Ok, what situation do we have here?
- Registered Member → (in which DATABASE ? (OWN or PrivateMembersData) ?
- Dynamic-page ok!
What is a dynamic page?
Isn’t it just an “entry” in your DATABSE, which is connected trough a DATASET with your Collection?
- Repeater, hmm ok!
What is a repeater?
Isn’t it just a kind of PROJECTOR, which is also connected trough a DATASET with your DATABASE ?
Your green-line to follow…
- Registration
- Navigation
- DATABASE
- Used elements (repeater / dataset / dynamic pages)
REGISTRATION: (user-info → ID / E-Mail and so on…)
So let’s say i am now a new User on your site and do a registration.
What happens when i do register on your site?
-a new entry will be created in the PrivateMembersData with some data about me?
(1) e-mail ?
(2) firstName ?
(3) lastName ?
Which data will be saved exactly in the PMD (PrivateMembersData) ?
And which data can be pulled out again of that PMD ?
https://www.wix.com/velo/reference/wix-users/user
https://www.wix.com/velo/reference/wix-users/currentuser
import wixUsers from 'wix-users';
2
3// ...
4
5let user = wixUsers.currentUser;
6
7let userId = user.id; // "r5cme-6fem-485j-djre-4844c49"
8let isLoggedIn = user.loggedIn; // true
9
10user.getEmail()
11 .then( (email) => {
12 let userEmail = email; // "user@something.com"
13 } );
14
15user.getRoles()
16 .then( (roles) => {
17 let firstRole = roles[0];
18 let roleName = firstRole.name; // "Role Name"
19 let roleDescription = firstRole.description; // "Role Description"
20 } );
21
22user.getPricingPlans()
23 .then( (pricingPlans) => {
24 let firstPlan = pricingPlans[0];
25 let planName = firstPlan.name; // "Gold"
26 let startDate = firstPlan.startDate; // Wed Aug 29 2018 09:39:41 GMT-0500 (Eastern Standard Time)
27 let expiryDate = firstPlan.expiryDate; // Thu Nov 29 2018 08:39:41 GMT-0400 (Eastern Daylight Time)
28 } );
Can i even get more data out of PMD ?
https://www.wix.com/velo/reference/wix-users-backend
import wixUsersBackend from 'wix-users-backend';
2
3export function getUser(id) {
4 return wixUsersBackend.getUser(id)
5 .then((user) => {
6 return user;
7 });
8}
9
10/* Returns a promise that resolves to:
11 *
12 * {
13 * "id": "dn8sf9c2-4e9f-a02d-a58d-f244d999729a",
14 * "memberName": "John Doe",
15 * "firstName": "John",
16 * "lastName": "Doe",
17 * "nickname": "johnd",
18 * "slug": "johnd123",
19 * "language": "en",
20 * "status": "ACTIVE",
21 * "loginEmail": "john.doe@somedomain.com",
22 * "creationDate": "2019-08-05T11:29:39Z",
23 * "lastUpdateDate": "2019-08-12T12:29:43.810Z",
24 * "lastLoginDate": "2019-08-12T13:42:30Z",
25 * "emails": [
26 * "john.doe@somedomain.com",
27 * "doughyjohn@anotherdomain.com"
28 * ],
29 * "phones": [
30 * "5555555555",
31 * "5555555556"
32 * ],
33 * "labels": [
34 * "contacts-new",
35 * "contacts-site_members_approved"
36 * ],
37 * "picture": {
38 * "url": "https://.../photo.jpg"
39 * }
40 * "customText": "Custom Text",
41 * "customNumber": 12345
42 * }
43 */
This is just the beginning, of what you have to know, when you want to achive your aim.
Navigation: (user-info → ID / E-Mail and so on…)
Navigate to a local link
CODE EXAMPLE
1import wixLocation from 'wix-location';
2
3// ...
4
5wixLocation.to("/about-me");
I saw a few of your questions. I know it is very confusing to see all that stuff for the first time, but if you want to get your desired projects come true, you should first learn about some coding, taking a carefully look onto the given APIs in the VELO-API-DOCUMENTATION.
Ok, forget about it. I do not want to confuse you even more.
So, how to make it more simple?
-
I am now a member of your site and my personal-data (like: e-mail/user & owner-id) is saved in your “PrivateMembersData” .
-
Now you want me to navigate to a special page (dynamic-page) where you will show me some stuff of one of your DATABASES, but you do not want to let me see my own DATA (which already have been created on one of your sites [because i am so fast xD]). Nowsome of my generated DATA is in one of your DBs, and now i am on one of the pages, where all the data is shown (mine included).
-
But you do not want that i see my own generated data in this (element → table/repeater). What you have to do now?
-
Figuring out my — ID (using the wix-user-API).
-
Searching the DB for my ID with the related DATA.
-
Do an IF-ELSE-STATEMENT to check if or not!
-
If YES —> then … do some code… (hide my own content, because it’s me!)
-
If NO —> do some other code… (show my own content, because it’s not me!)
and so on …
This is how i would solve it —> follow your logical way… step-by-step.
