Hello
a → you can query the collection and see the results where the field equals the value.
b → you can use ‘&&’ expression of nested if statement or any other way u find suitable for the case.
here’s how i would suggest doing it if you have the user’s id in the database(if not you can use the field and value u want to search based on):
//you can call this function in $w.onReady()
async function show_buttons() {
let logged_in = wixUsers.currentUser.loggedIn;
let tybe_empty = await wixData.query("myCollection").eq('_id', wixUsers.currentUser.id).eq('users', 'empty').find();
let tybe_clien = await wixData.query("myCollection").eq('_id', wixUsers.currentUser.id).eq('users', 'client').find();
let tybe_temp = await wixData.query("myCollection").eq('_id', wixUsers.currentUser.id).eq('users', 'temp').find();
if (logged_in) {
$w("#login1").label = "Logout";
if (tybe_empty) {
$w("#account1").hide();
$w("#account2").hide();
} else if (tybe_clien) {
$w("#account1").show();
$w("#account2").hide();
} else if (tybe_temp) {
$w("#account1").hide();
$w("#account2").show();
}
} else {
$w("#login1").label = "Login";
$w("#account1").hide();
$w("#account2").hide();
}
}
you can see here to know more about querying a collection.
best!
Massa