Forum Discussion
Hi Vikas,
Thanks for your reply!,
I have created two custom components:
<component id="common.widget.custom-content" name="13"/>
<component id="common.widget.custom-content" name="14"/>
13-Managers and 14- Users.
If Managers logged-in then, the both custom components should be visible and If user's logged-in then only one user's component should be visible.
I want to restrict 13- (custom component) for users? How can I do this?
I tried to add your code in wrapper--> Page head top content.
<#if !user.anonymous>
<component id="common.widget.custom-content" name="13"/>
</#if>
The above given code is not working.
And please provide me a clear code.
Thanks,
Sateesh.
sateesh999 are your users who are logged in part of a role? If you have multiple personas, you may want to go off role rather than logged in/logged out (else a combo may be needed). Example:
<#attempt>
<#assign user_has_role = false />
<#if user.registered >
<#list restadmin("/users/id/${user.id?c}/roles").roles.role as role>
<#if role.name?? && (role.name == "Customers" || role.name == "Administrator" || role.name == "Banana")>
<#assign user_has_role = true />
</#if>
</#list>
</#if>
<#if user_has_role >
CONTENT IF IN THE ROLE SHOWN HERE
<#else>
CONTENT IF NOT IN ROLE SHOWN HERE
</#if>
<#recover>
<!-- Something bad happened -->
</#attempt>
Related Content
- 4 years ago
- 4 years agoInactive User