Forum Discussion
Thanks for the info. I'll test this out and see if it could work.
Kent
Wanted to share this in case anyone else is looking for this info:
I didn't do it exactly like the recommendation but I did create a completely conditional homepage that works great and is very easy to manage. The manage part was the part I was worried about. I was able to create three versions of the user-nav, header, footer and left-column custom content box that renders based on someone's role. The challenge is what to do when someone is a member of two roles that each have their own homepage. Here is the code that I used for my conditional header. Basically I created three headers in Custom Components and then I created one Custom Component that is my primary header element. It renders one of the three header options based on the roles. Take a look and let me know if it makes sense or not.
<#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 == "BBCRM")> <#assign user_has_role = true /> </#if> </#list> </#if> <#if user_has_role > <@component id="bbcrm.header.component"/> <#else> <#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 == "BBRE")> <#assign user_has_role = true /> </#if> </#list> </#if> <#if user_has_role > <@component id="bbre.header.component"/> <#else> <@component id="bblum.header.component"/> </#if> </#if>
Related Content
- 7 years ago