Display custom message for visitors when enter a restricted category



In the community that I'm working on we have some categories that are restricted to some users. How can I display custom message for this users when they enter a restricted category?

something like "Sorry, this si a close community. If you would like to ask for access please contact us at... "




Message 1 of 8

You can do it using customisation. The message can be shown if the user has that particular role after that we can redirect to the last visited page. 

Give kudos if you find my posts helpful or mark solution if it answers your query
Message 2 of 8

@VikasBwhat kind of customisation? Is something that I can do from studio and admin?

Message 3 of 8
Community Management
HI, would be a small amount of development in studio, its not something you can configure in admin.


My latest Ideas: Vanity URL Manager l @mention Roles l  LSW Password Policy

Message 4 of 8

And I'm back at my first question.. how? Smiley Happy

Message 5 of 8


1. Write a code to check if the user has that specific role. If no, just show the pop-up and redirect the user to the last visited page or homepage. 

2. Add the code in the header so it would work for the deep link as well(also wrap this function in condition so it can work on that restricted category only).

Give kudos if you find my posts helpful or mark solution if it answers your query
Message 6 of 8

In our community, we edited one of the default error messages to display the message we wanted -- rather than using a customization.


Here are the text keys we used:



The message displays when a user attempts to access a node or piece of content that they don't have permission for.


Lili McDonald
Community Manager @ National Instruments

Message 7 of 8
Community Management

You need to build a custom component (Tutorial on building a custom component: https://community.lithium.com/t5/Developer-Knowledge-Base/Component-tutorial-Building-your-first-cus... ) which checks for the presence of the necessary permissions to access a node (See https://community.lithium.com/t5/Developer-Discussion/Check-specific-permission-of-a-role/m-p/385781... If the current user doesn't have the permission you will output a helpful message (Using the "text" context object to output a string: https://freemarker-docs-portal.lithium.com/refer/contextObjects#text ) instructing them how to request the role.

Finally you add this custom component to the page layout for the UserLoginPage which is where visitors without the necessary permissions to access a node will get redirected. See the advance studio course on layouts here: https://community.lithium.com/t5/Developer-Knowledge-Base/Advance-Studio-Documentation-Part-1-Layout...

Learn how to master Lithium. Visit the Best Practice Center

Previously known as Claudius. New profile - Now even more content
If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.
Message 8 of 8