Limiting page access to certain users

Is there a way we can limit site members (registered users) to only access certain pages that they are authorized to, and not the others?

For example - A student registered for coding 101 will only have access to pages for that course, and not for coding 102, unless they get the permission for 102 as well.

Hi,

Take a look at the wix-users API . You can have users sign up and login in using different user levels (visitor, member, admin). This will get you started with site users.

To take it to the next stage, read How to Create Member Profile Pages with Wix Code . Using the techniques detailed in this article, you can add information for each user such as course, curriculum, year, etc. These additional fields could be used to allow or prevent access to certain pages by specific users.

Good luck, and happy new WixCode year,

Yisrael

“These additional fields could be used to allow or prevent access to certain pages by specific users.”

Can you please give me an idea on how to accomplish this.
I have one field named Categories. Should I have different fields for each category?
(I have already created Member Profile Pages with Wix Code)

There’s only 2 types, either member or guest. So pages can be available to MEMBERS (ALL), GUESTS (ALL) or you can use a PASSWORD but you can’t limit them to admins or certain users.

Thank you, Carlos… that makes sense.
So I guess I’ve been asking a wrong question.

The right question would be:

  1. How to display content, based on the field in the Member’s collection. For instance, Zip code.
    So when member clicks on “My Community” link, it will be directed to the page for his Zip Code.

OR

  1. How to create a (dynamic) link based on the field in the Member’s collection (Zip Code). So, when a member clicks on this link (“My Community”) it will be directed to the page for his Zip Code.

Unfortunately I know about programming just enough to be dangerous but it seems to me that simple IF statement should do the job.
IF you’re Member and IF your Zip Code is 5555 go to page wwww.mysite.com/5555

I know, I make it look so easy :slight_smile:
Thank you in advance!

Hi,

Check out this article regarding adding a dynamic category page.

When you set the dynamic page url, Instead of adding ‘meals’, you will need to add the zipcode field from your collection.

To link to the dynamic page, use wixLocation.to on a button’s onClick event with the following url:

//get the current user's zipcode then:
wixLocation.to("/dynamicPageName/zipcode");