I searched through the forum and found a code that seemed to be exactly what I needed. In my case, if a user has the role of “SiteAdmin” then show “Button161”. It simply does not seem to work though. Users sign in do not have the role of “SiteAdmin” and can still see the button. Any help would be greatly appreciated:
});
import wixUsers from ‘wix-users’ ;
$w . onReady ( function () {
const currentUser = wixUsers . currentUser ;
if ( currentUser . role === ‘SiteAdmin’ ){
$w ( ‘#button161’ ). show ();
} else {
$w ( ‘#button161’ ). hide ();
}
});
});
Just a reference to an old collection I deleted but I dont think its related, otherwise there is nothing:
"Running the code for the Intranet page. To debug this code in your browser’s dev tools, open sw891.js.
ServerValidationError: Initial data fetching failed for one of the datasets Caused by Error: WDE0026: The IntranetLoanProgramLanding collection was removed, so you cannot work with it. To restore its data, create a new collection with the same name.
Caused by: Error: WDE0026: The IntranetLoanProgramLanding collection was removed, so you cannot work with it. To restore its data, create a new collection with the same name."
Its almost like it doesnt even see the code there for some reason. I have my role named “SiteAdmin”. Thank you for taking a look.