Made this code to hide a button if a person does not have a specific member role. Works and thought someone might find it useful.
any tips to improve also welcomed.
import { currentMember } from 'wix-members';
$w.onReady(function(){
currentMember.getRoles()
.then( (roles) => {
let isVolunteer = false;
for (var i = 0; i < roles.length; i++) {
var firstRole = roles[i];
var roleID = firstRole._id;
if(roleID === "xxxx"){
isVolunteer = true;
}
if(isVolunteer) {
$w('#button29').expand();
} else {
$w('#button29').collapse();
}
}});});