Trying to create a custom member dashboard. HELP

Hoping to get an answer soon as I want to hook up my domain and make this live tommorrow. I am attempting to adapt this tutorial to keep the member dashboard hidden Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com.

So I have this member area Here.
https://shchamberweb.wixsite.com/shtchamberbuild-demo/members-area

I want the buttons to say login, Membership Application, Forgotten Login, when not logged in.
When logged in I want it to say Logout and Enter Member area.

It was working until I removed the database part of the code


. I’ve gotten the button’s to hide just fine. Just the login log out pressing and the enter member area is not working. button 3 and button 4 refer to Membership Application and Forgotten Login. Here is my code.

Looks like you have a problem with mismatched braces.


I might be mistaken, maybe you want your loginButton_click() function to end on line 35, but I don’t think so.

Mike, that’s what I thought, but it required me to put it back in. But maybe I’m miss understanding. How would you update the code?

Move the closing brace down to line 40

Actually, no, I didn’t look carefully enough at it.

It looks to me like between lines 31 and 32 you need to insert

else {

and the closing “}” down on line 40.

Also, wixUser.promptLogin( ) is not a normal (synchronous) function, since it returns a promise.

You need to use “.then”, which you can see examples of on this page:
https://www.wix.com/code/reference/wix-users.html#promptLogin

Sorry, but can you actually exemplify what you mean by editing my code? The prompt login is a little confusing. I am having a hard time editing it myself

Hey your problem is that you removed the database part of the code. That code is needed for users to sign up and login to get into the members dashboard area. Without that code you have no way of saving the user to the database to keep track if they are a member. Is there a reason why you took out the database part of the code?

Luke,
Yes there is a reason. I didn’t think it was needed since I never created a collection called members. Let me know if I should. I thought it was referencing the database collection not the user database.

Hey Elizabeth no problem. Yeah you should create a members collection and have a field for the members email. Then when you add that database related code back in it should work! Let me know if you have any problems!

ok. I will. I’ll check in like an hour.

Luke,
Quick Questions: Do I need a dynamic page? Just email in the database right? I have no first or last name because this is a general member for all members.

Luke,
Still not working permissions are set to the following:
members collection to Custom Use and choose the following:

  • Who can read content from this collection? - Site member author

  • Who can create content for this collection? - Site member

  • Who can update content from this collection? - Site member author

  • Who can delete content from this collection? - Admin
    This is what I have

I decided to link Enter Member area to the actual page. So, I eliminated the location. I don’t have the id field in the database just a blank title and the email. Thanks for all the help.

Hey Elizabeth did you publish your site? Maybe I can look at the the page you’re making to help find the problem. Your code seems to look fine and I think those permissions should work.

Luke it is published. Do you need to know the user?

I think it should be fine because I can just sign up as a test user.

ok.

but the test user will not be linked to the database since there is no dynamic page.

Ok I just looked at the site and the Login button is not working. Did you make sure you connected the loginbutton_click() function to the actual button?

yes it is linked.

Hey Elizabeth I think it is working now. I was just able to click the login and I signed up and once that happened the members area button showed up and the Login button changed to Logout. Is that where the problem was?