Hi Wix Team,
I have a simple project with Home page and one dynamic page.
SCENARIO:-
The home page url is like “user.wixsite.com/mysite/”. The home page is of no use.
and the dynamic page url is like “user.wixsite.com/mysite/students/class1”
the data “class1” in the above url is the dynamic value of the field “class” from the collection Students like below.
Student Class RoleID
-----------------------
Sam class1 1
John class2 2
Lui class1 3
dynamic page url is like like below
“user.wixsite.com/mysite/students/{class}”
a student can be in any class from 1 to 12 like “class1, class2, class3 … class12”
My project is accessible to Teachers(Who register and login as a site member
Every Teacher is assigned to a class in Collection like below
Teacher Class
-------------------------------
Teacher1@gmail.com Class1
Teacher2@gmail.com Class2
the page “user.wixsite.com/mysite/students/{class}” is bind to a dataset to list students of a specific class based on the url.
Its working fine for now.
The issue is that I want a functionality that when a teacher log in then
- It should automatically detect its assigned class (Which I can do by query database but I don’t know where to put this code, somewhere in routing or common page?)
- Load the url according to the logged in teacher assigned class, so that he/she can see all his class students only
for example if “Teacher1@gmail.com” logins, then my site automatically redirect to “user.wixsite.com/mysite/students/class1” and load students “Sam and Lui”.
The dataset is already bind to dynamic field class and loads data according to the url.
but when I log in,I land on home page and then I need to manually open the dynamic url.
also a teacher can open other class students also, which i don’t want.
NOTE:
I understand that its possible by routing but when I create a router the it adds a new router page. I want a routing code that is common for all the pages I open.
So in routing I can write logic to detect a Teacher class and redirect him/her to respective dynamic page.
Thanks for reading and please let me know if you don’t get anything from above points.