Um,
First of all, in your registration code may add one more checking code to find out
Does “email” cannot find in both database?
It’s because in your code sims to miss this checking.
Quite right. That’s what I’m trying to do.
The next problem is that if you want to use two database for two type of web users.
it may not be the role, since they are two different database.
If using one door for both users, it sims not good.
And if it is a single database. Will they only go to the designated pages?
Yes, it is possible.
You just need to add limit to trigger.
Coding which type of member can go to page you want.
I do not mind, let there be one database. Then there it is necessary to make separate fields for each role. And then, how will the program be understood by email from someone what role and who should be on which page?
Got it. A uyvas has the opportunity to show this in the picture. I just do not quite understand what a trigger is ![]()
There will be one database, but two different dynamic pages?
It turns out that there will be one page for the entrance but everyone will choose the one under which will be included. But then the visitor under the role of the client can also go to choose not his role, with the initial entrance.
For coding inspire,
In the end of registration code you can set up navigation.
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() {
//if loggedIn then loggedOut
if (wixUsers.currentUser.loggedIn) {
wixUsers.logout().then(()=>{
//Update button...
$w("#loginButton").label = "Login";
$w("#profileButton").hide();
});
} 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,
"identity": false
};
// add the item to the collection
wixData.insert("Members", toInsert).catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w("#loginButton").label = "Logout";
$w("#profileButton").show();
// navigate to page
let identity = $w("#Memberdataset").getCurrentItem().identity;
if (identity === false) {
wixLocation.to("/pageForNonemployees");
} else if (identity === true) {
wixLocation.to("/pageForEmployees");
}
} ).catch( (err) => {
console.log(err);
} );
}
}
Thank you so much!!! I am your debtor
I’ll try to adjust it in work.
I understand, the third line is the drop-down list (the field on the login page) of the roles?

Hi again,
“identity”: false may refer to a limit with your member.
It means when someone create an acount on your website, who cannot go to page for employees until the admin changes the identity from false to true to upgrade that member become an employee.
You can create a admin dashboard, which can change your members identity to upgrade a member to become a employee.
Generally, the “identity” only can change in database or in admin Dashboard you create.
Put it in the inspire because it will become a key for navigation. Therefore, it can not be an undefined value.
Hope useful. Good luck,
Heson
Thank you very much!!!
I can not set up navigation

I understand you need to insert this function somewhere?

In the collection, I created the “identity” column:
What would it be possible to change the role of the participant there. But where do you put it in the code?
When I click here after login, nothing happens

Excuse me for being so stupid ![]()
And yet I did not understand why I have this here:
![]()
After all, there is no data source for the input
Once again I apologize for the trouble !!! But I think I will soon learn ![]()
Hello all,
We are dealing with a similar issue and judging from this conversation it seems like you may be able to help, can you please check out the following thread?
Thanks, talk to you soon.
Look at this. Can help.
https://support.wix.com/en/article/how-to-create-member-profile-pages-with-wix-code
I have the member page already set up, the issue is having a read or write function work for another database which is not the member database.
I’m able to input data as write only, however as soon as I change it to “read and write” it stops working
Hello Heson Li !!!
Will you help me to the end with this question? Neither can I end up making this function work. I would be very grateful to you !!!
