Member-specific pages

Is it possible using Wix Code to create a dynamic page (like a profile) for each site member, so that, for example, if they have previously booked a hotel on a website, they can view this on their profile?

Thanks in advance.

Are you asking if it can integrate with Wix Hotels? Because I do not think it is possible yet (no Wix API’s).

But yes, you CAN create a profile page so member can access information only THEY have ‘submitted’ to the database …

So if you create a database with a form (for example) that books hotel rooms … then this information is stored in your database, and you can set the permissions so that ONLY the person you added the information can VIEW & EDIT it at any time.

This are native permission settings on Wix Code, no ‘coding’ required. lol :slight_smile:

3 Likes

Ok, thank you very much for replying!

I was just using a hotel booking system as an example, by the way.

1 Like

No problem! There is also another thread that could possibly interest you … : )

1 Like

Thanks for the thread link!

How would you go about creating a page for every member (do they have to submit something for it to work with a dynamic page)? Is it possible to access the site’s members database, or would this involve coding it instead?

Also, would it be possible to display the date each member joined on their profile page as plain text?

Thanks again.

1 Like

You should be able to get away with little or no coding, it has been designed for your scenario.

Yes, they have to submit a form, which you link to a database, which in turn you link to a Dynamic Page. One dynamic page will automatically create pages for all your members.

Re Date : There is a field in the database which when the form is submitted to the database is autopopulated with the date and time. I’m not sure how to display it though on another page.

1 Like

Ok, thanks for your response!

Just a short note from us at wix-code:
Seeing the community help each other out is exactly what we have hoped would happen.
Warms our heart :wink:

2 Likes

JDS404 - I made a video on something similar. Don’t know if you’ve seen it on the Facebook group yet. It was uploaded to the Wix Community YouTube Channel. Here is the link:

2 Likes

Thanks for the video, Nayeli. A big help for creating profiles using Wix Code!

1 Like

I watched the video, very useful thanks. Would love to see the example taken further forward with the ability for the users to update their profiles at a later date eg. if their availability changes and also how to build a custom search function across the database.

1 Like

Good requests. I will work on that :slight_smile:

We just added a new article demonstrating how to create a member profile page for each of the registered users of your site.

https://support.wix.com/en/article/how-to-create-member-profile-pages

We’d appreciate any feedback on whether or not you find the article helpful.

1 Like

Hi Nayeli,

i have followed all your steps for creating custome member login page and done coding accordingly but it is not working showing some error, please help me…the below is the links

Page Link :

Error link: https://gdexindia.wixsite.com/gdexindia11/Member/Update/ID

My Wix Account Log in Link : https://www.wix.com/my-account/sites/cc46de08-d072-4d32-896e-6612cf62d781/site-settings/overview?referrer=site-home

my coding :

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

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

export function button1_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button1”).label = “Login”;
$w(“#button2”).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("Member") 
      .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("Member", toInsert) 
        .catch( (err) => { 
          console.log(err); 
        } ); 
    } 
    // update buttons accordingly 
    $w("#button1").label = "Logout"; 
    $w("#button2").show(); 
  } ) 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

export function button2_onclick() {
wixLocation.to(/Member/Update/ID ${wixUsers.currentUser.id});
}

Note : I want to Add and Additional Accounting Area or Table through which my member can view their Balance and account statement (How to Add it i dont know) because i just follow your steps in coding and creating website…i am not technical and IT Person …but interested to create website according to my requirement

Request you to Please give or add coding for Basic account statement generation like Account No., Amount Deposit,Withdraw, Final Balance in Table form in the above mention code

So Please Help me as soon as possible

1 Like

Hi Nayeli,

Please do the needful for the above request

Hello Liran

i have followed all your steps for creating custome member login page and done coding accordingly but it is not working showing some error, please help me…the below is the links

Page Link :

https://editor.wix.com/html/editor/web/renderer/edit/7b1a1493-bd68-433a-889f-7c382be000cc?metaSiteId=cc46de08-d072-4d32-896e-6612cf62d781&editorSessionId=FC3DE292-3B89-44DC-93A5-5C7A9CDDADEC

Error link: https://gdexindia.wixsite.com/gdexindia11/Member/Update/ID

My Wix Account Log in Link : https://www.wix.com/my-account/sites/cc46de08-d072-4d32-896e-6612cf62d781/site-settings/overview?referrer=site-home

my coding :

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

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

export function button1_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button1”).label = “Login”;
$w(“#button2”).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](http://user.id/) ; 
    return user.getEmail(); 
  } ) 
  .then( (email) => { 
    // check if there is an item for the user in the collection 
    userEmail = email; 
    return wixData.query("Member") 
      .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("Member", toInsert) 
        .catch( (err) => { 
          console.log(err); 
        } ); 
    } 
    // update buttons accordingly 
    $w("#button1").label = "Logout"; 
    $w("#button2").show(); 
  } ) 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

export function button2_onclick() {
wixLocation.to (/Member/Update/ID ${ [wixUsers.currentUser.id](http://wixusers.currentuser.id/) });
}

Note : I want to Add and Additional Accounting Area or Table through which my member can view their Balance and account statement (How to Add it i dont know) because i just follow your steps in coding and creating website…i am not technical and IT Person …but interested to create website according to my requirement

Request you to Please give or add coding for Basic account statement generation like Account No., Amount Deposit,Withdraw, Final Balance in Table form in the above mention code

So Please Help me as soon as possible

When this question was first posted, there was no Wix API’s to integrate Wix Code with Wix Hotels? Is that still the case or has something been created that will show Member-specific data such as current reservations on their Profile or Account page?

Hi,
Still no integration between Wix Code and Wix Hotels.
Roi.

Hello by any chance this video is still available