Display or Hide HTML Elements Based on Whether a Member is Logged In
You can hide content from users who are not signed in or from users who are signed in if you have access to the HTML to edit the class names. This can be used to create member only navigation for example.
Note: This feature is not currently available in Wix
To make a DOM element visible only to logged-in users, add the SF_li class to it. Conversely, to make a DOM element visible only to logged-out users, add the SF_lo class to it.
Then add the following
script to the bottom of the page if you want this to work on specific
pages only, or in the site footer if you want this to work throughout
the site:
<script>(function(){var
i,j,a,x;try{x=localStorage.getItem("SF_nam");}catch(e){x="";}try{for(a=document.querySelectorAll(".SFnam"),i=a.length-1;i>=0;i--)a[i].innerHTML=x?x:"";}catch(e){}try{for(a=document.querySelectorAll(".SF_li"),i=a.length-1;i>=0;i--)a[i].style.display=x?"":"none";}catch(e){}try{for(a=document.querySelectorAll(".SF_lo"),i=a.length-1;i>=0;i--)a[i].style.display=x?"none":"";}catch(e){}})();</script>
This only checks if the user is logged in, and does not detect
what labels/folders the user has, or if their membership is
expired. Note also that the above only works if the page is on the same
domain (including HTTP vs HTTPS) as the login page. This does not work
if the page is HTTP and the login page is HTTPS and vice versa.