Many users of one account

How to add more than one user to one account?
A registered user can add another user to his account on the site to view data on the account

Hi,
For every user save the names of the users he is able to access, when a user logs in, check whether he has permissions to view other users data and get that data using query .

Let me know if you need further help,
Or

Hello
Thank you for your response. How can I do this? because I do not know coding very well. I have a code that I got down but I do not know if it is correct and how to implement it :frowning:

Database 1 called : “Members”
Database 2 called : “StudentRecordsDB”
Member logs in then is directed to this page, where both of these databases have been imported.
let selectedCategory = “”;
let emailholdervr = $w(" #emailholder “).value;
wixData.query(“Members”)
.eq(“title”, emailholdervr) <---- QUESTION IS HERE
.find()
.then( (results)=> {
let firstItem = results.items[0];//First item in results
selectedCategory = firstItem._id;
wixData.query(“StudentRecordDB”)
.eq(“usemail”,selectedCategory)
.find()
.then ((results)=> {
$w(” #repeater1 ").data = results.items;
})
.catch( (err) => {
let errorMsg = err;
});
});
I am using a form field to retrieve the email address from the database “Members”. The email appears perfectly on the page, but just isn’t being passed through the code.
This works if I type in the email:
let emailholdervr = "tommy111@tommy.com "

Hi,
Lets say we have a field named “accessUsers” in “members” collection, if we want to display the data saved in “studentRecordsDB” for these users we will use the following code(modify the code to match your site):

wixData.query("members")
  .eq("user", wixUsers.currentUser.id)
  .find()
  .then( (results) => {
    let item = results.items[0];
    let data = [];
    for(let i=0;i<item.accessUsers.length;i++){
      wixData.query("studentRecordsDB")
      .eq("name",item.accessUsers[i])//"name" field is an example
      .find()
      .then((results)=>{ data.push(results.items[0];)}
    }
    //in data variable you have the information about the accessible     
      users, write your code here to use this data.
  } )
  .catch( (err) => {
    let errorMsg = err;
  } );

Good luck :slight_smile:
Or