Skip to main content
Solved

Sidebar visibility/permissions


Hi!

Is it possible to hide sidebar content (e.g. leaderboard and badges) from non-logged in users (guest)? I couldn’t find any “Permissions” option for these. 

I’d want that the sidebar content is visible only for logged-in users.

 

 

Best answer by olimarrio

'

Hi @Alexandra Prinz ?,

There aren’t permissions for the visibility of these widgets. However, it is possible using the inSidedDataObject:

 

 

For instance if you applied some styling to the leaderboard widget so that it doesn’t display by default, you could add some code in Control → Customization → Third-Party Scripts such as:

<script> 
  if (inSidedData.user.role != ''roles.guest'') { 
    // Make the widget visible 
  	$(''.qa-widget-leaderboard_points'').removeClass().removeAttr(''style''); 
  } 
</script> 

This would make the widget visible only if the primary role of a user is not a guest.

If you need any help with this please let support@insided.com know and we’ll be happy to help.

Thanks!

'
View original
Did you find this topic helpful?

3 replies

olimarrio
Forum|alt.badge.img+4
  • Gainsight Employee ⭐️
  • 404 replies
  • Answer
  • July 27, 2022
'

Hi @Alexandra Prinz ?,

There aren’t permissions for the visibility of these widgets. However, it is possible using the inSidedDataObject:

 

 

For instance if you applied some styling to the leaderboard widget so that it doesn’t display by default, you could add some code in Control → Customization → Third-Party Scripts such as:

<script> 
  if (inSidedData.user.role != ''roles.guest'') { 
    // Make the widget visible 
  	$(''.qa-widget-leaderboard_points'').removeClass().removeAttr(''style''); 
  } 
</script> 

This would make the widget visible only if the primary role of a user is not a guest.

If you need any help with this please let support@insided.com know and we’ll be happy to help.

Thanks!

'

davetee
  • Helper ⭐️
  • 25 replies
  • September 21, 2023

Thanks @olimarrio 

I used a modified approach to hide a second leaderboard I created for only employees to see. The end-user and employee leaderboards are side-by-side and have exactly the same class selectors. There may be a better way to do this by looking at the leaderboard name and then hiding the div above it, but I went with the approach of hiding the 4th child in the right sidebar. In my particular case, the 4th child is my employee leaderboard. Anyone else using this will have to modify the div:nth-child(4) to hide the correct widget in that stack. For example,  div:nth-child(1), div:nth-child(2), div:nth-child(3), etc…. 

 

<script>
//load the InSidedData.user.role data into a variable
myRoles = window.inSidedData.user.role;

//search for substring 'Employee' - returns true or false
EMPresult = myRoles.includes("Employee");

//if it is not an employee, hide the employee results
if (EMPresult == false){
$("div.widget-container--container-2-1-column_2 div:nth-child(4)").hide(); 
}
</script>

 


Alistair FIeld
Forum|alt.badge.img+2
  • Helper ⭐️⭐️⭐️
  • 247 replies
  • September 22, 2023

Thanks for contributing to the wider knowledge of the community @davetee .

 

👍🏻


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings