I’m looking into using Wix for a website. On the site’s homepage I want to be able to display content for all users (registered or unregistered), and then display additional content once the user is registered and logged in (still on the homepage).
The page shouldn’t be hidden behind a “members only” wall or anything like that. I want it accessible to the public and registered users, but I want to limit the amount of content the unregistered users can see.
I looked into doing this with the provided APIs
import wixUsers from 'wix-users';
$w.onReady(function () {
if(!wixUsers.currentUser.loggedIn){
$w("#vectorImage1").hide(); // content hidden if you're not logged in
} else {
$w("#vectorImage1").show(); // content visible if you're logged in
}
});
This technically works but it seems like all it’s doing is setting the element’s visibility to “hidden” which can be easily overridden in the dev console.
Is there a way to do this that doesn’t just “hide” the element using CSS, but actually removes it from the DOM, or is this beyond the scope of Wix Code?