New Article: How to Create Member Profile Pages

hello guys, I’ve done a tutorial of “How to Create Member Profile Pages with Wix Code” I leave the links

Part 1: - YouTube

Part 2: - YouTube

part3: - YouTube

leave your comments!

Make sure your database permission are set correctly.

I’ve followed the instructions and I’m getting a 404 URL not found error. My database is “OfficialsData” and I have 2 Dynamic Pages “OfficialsData ID” and “OfficialsData Update ID”. Members are required to login in order to reach members page but to keep is simple I’ve left the login checks in place to follow standard code.

I’m trying to have members review there profile data. Some fields are read only and just displayed. Others they can update. “OfficialsData/ID” is to show all fields if any of the updatable fields need to change they move to “OfficialsData/Update/ID” page to make changes. I can never get it to load “OfficialsData/ID” page using logic below. Any help is greatly appreciated.

here is my code and I’m frustrated with the 404 URL not found error.
https://luftms27.wixsite.com/website

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

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

}
}
export function profileButton_click(event) {
wixLocation.to(/OfficialsData/${wixUsers.currentUser.id});
}

i need videos

How to reset password i case user forget the login details??

Hi Araiki — this method used in the Article uses the Wix Member Login app. Which means the app does all the ‘what if i forgot my password’ work. :wink:

(Subscribe to my Channel)
(And join me on Facebook: Totally Codable Community - Web Design, Wix, Velo, No Code and more . . . | Facebook)
You can also follow me here: https://www.wix.com/code/home/members/nayeli-gomez
Here is a tutorial video link: 2017 Create Member Profile Log In Page - Custom Private Client Member Dashboard - Wix Code - YouTube

Hey there – what is to prevent a logged in user from entering the URL of some other user’s profile page and seeing their information? I don’t see any mention or confirmation that this is not possible in the online resources I’ve seen.

No it wont be possible.
If you set up your membership environment to use e.g. domain.com/accounts/myaccount
then every user/member will see the same url for their account page

Hi,

I have succeeded creating Member Profile page based on the guiding article on Wix Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com

I want to ask what If I replace the login page by the ready-made Wix login button place on Header. Once they login they can click to the “Profile page” button to view their profile (this button don’t need to hide once user log out as I place the button on member-view only site).
So how can I custom the code to make this happen?

Thank you