Skip to main content

I have an HTML widget that is public to anyone who visits the community home page.  I want to make it visible only to members who are logged into the community. It’d be even better if I could make it visible only to a specific user role. Is there a way to do this? 

Yes, I did this with the help of support. 

You use this third party script in the Before </body> section.

<script>
  
 if (inSidedData.user.role == 'roles.guest') {
    document.getElementById('name of your widget').style.display = "none";
 }
 
</script>

 

For that to work, you need to name your widget in the HTML in the front end HTML widget setup to work 

<div id="name of your widget">

the rest of your html code

</div>

 


Reply