New Article: How to Create Member Profile Pages

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

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

9 Likes

OMG, I have needed this for years. Can’t wait to get a minute to read and experiment. Thank you.

I followed this step by step and initial tests indicate it is working great!! I will let you know if I encounter any bugs when I test it further! Thank you for a VERY easy to follow guide!!

I have used this. Works very well, should be a popular article

I already put it into practice, but several things happen to me:

  1. when it is going to make a register of new user stays loaded and says failure in the server.

  2. sometimes does not let me register a new member, because it says it already exists. And it is not so, because that one member is not in the DB.

suggestions… ??

test the site and leave your comments and ideas
here is the link to test the site:

https://gadgetsutiles.wixsite.com/misitio

I created a profilte (test.test@email.com) and it did create the account. I tried to update it and no fields were showing. Still in progress? Feedback

Hi Marti

the fields to update are displayed when you click on the “Actualizar” button

try again please

Any suggestions to improve the interface and the operation I will gladly accept it.

I successfully used this tutorial. However, how can I get it so that it automatically forwards the user to the “update” page after creating a profile? Right now, it creates a profile, which is great!, but it then it’s just blank.

While we’re on the topic, is there any way to automatically pull certain information from their login? For example, if they log in through G-mail it will auto populate fields in our database??

I too would like to know the answer.

Hi.
I have a site that should require users to pay a subscription fee. So at first I just want to set some things:

  1. I want to create a member profile page.
  2. I want the login button to run a query that looks for a user ID in the collection I’ve created.
  3. I want to redirect the users by their position: if the user exists in the payed members collection he needs to be redirected to a specific page. And if the users does not exists in the collection he needs to be redirected to the purchase page.
    when Im clicking the login button I created nothing happens and it says I have a problem in my code.
    the code Ive used:

import wixUsers from 'wix-users'; 
import wixData from 'wix-data'; 
import wixLocation from 'wix-location'; 
import wixWindow from 'wix-window'; 
export function profileButton_click(event) { 

wixLocation.to (/PaidMembers/${ [wixUsers.currentUser.id](http://wixusers.currentuser.id/) });
}
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 a match for the user in the collection
userEmail = email;
return wixData.query(“PaidMembers”)
.eq(“_id”, userId)
.find();
})
.then((results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// redirect to pay for subscription
wixLocation.to (“/store”);
}
// if there is a match redirect to lessons page
else {
wixLocation.to (“/arabiclessons”);
} );

Thanks!

Sam,
I have a custom membership database and have a membership application form with 19 inputs and a submit button connected to my custom membership the database. When I submit, the record goes into the live database as expected. This will be a paid membership and I know that is in the works but I wanted to experiment with the member profile update feature described in the above article.

I have implemented wix code as shown in the article to allow the member to edit his profile using a duplicated copy of the membefrship application form which has been changed to a dynamic page to retrieve info from the database.

I have double checked the code in the article and still cannot get it to work. After I login, The Login button changes to Logout and the My Profile button shows. But when I click on My Profile nothing happens? Can I please get a review of my site and tell me what I have missed?

Also, since passwords are not stored in my custom database, at the default Wix Login page I had to actually use the Set Up link to create the account? Is that normally the way this should work? That is just going to confuse my members as one just submitted the enrollment form which has NO Password Field? Should I add a Password field to the form and will that be used for the default wix login?

For me it does not work… Here is my code in the page Login Client

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("Customer") 
      .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("Customer", 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(/Customer/${wixUsers.currentUser.id});
}

My database is called Customer
WHERE IS MY MISTAKE :frowning:

I cannot get it to work either? Here is MY code:

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

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

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

}
}

export function button3_onclick() {
wixLocation.to(/CVOA_Members /${wixUsers.currentUser.id});
}

It does not work for me to. See post https://www.wix.com/code/home/forum/questions-answers/create-member-profile-failed

Still no logical anwer for me :frowning: I am sad today lol

Yeah, been fighting with this for a week! So much for VIP support. They will not help because its part of Wix-Code!

The strange thing is that it appear that it is working for some people and some not. I know that the code of my website is good as a moderator of Wix succesffuly sign in as he told me. but for me, nada…

I can login with out a problem and the Login changes to Logout and it displays the My Profile, but clicking on My Profile does NOTHING for me??

Click on your Login button, then look at the Properties menu. Make sure you have the button2 enabled by default and the OnClick name matches your code

Yes I’ve look and it’s all ok. :frowning: Still does not work