For different roles, I have some member area pages that are usable and some that are not - for example, the Wix Forums pages are only usable by members in a Participant role, not for members who are new to the site.
In the Members Area, the links for the Wix Forums show up for everyone. I have the Forums configured so that only Participants and Admins can access the Forum pages. But on the Members Area vertical menu, the “Notifications”, “Followers”, “Forum Posts”, and “Forum Comments” links show up for all members, not just Participants and Admins.
I have code on the page to detect that the role of the member, but I have no idea how to access the page elements for the Members Area vertical menu.
Does anyone know how to do this?
Here is the code I have:
import wixUsers from ‘wix-users’ ;
$w.onReady( function () {
let user = wixUsers.currentUser;
let isLoggedIn = user.loggedIn;
if (isLoggedIn) {
user.getRoles()
.then( (roles) => {
let hideMenus = true ;
for ( let role of roles) {
if (role.name === “Admin” || role.name === “Participant” ) {
hideMenus = false ;
}
}
if (hideMenus) {
//$w(“#verticalMenu1”).hide(); // don’t want to hide the entire menu, just some items on it
//or even
// $w("#verticalMenu1).item(“Followers”).text = “”; //but I don’t know this API
}
});
}
});
Thank you!
tom