Forum Discussion

twitchee27's avatar
13 years ago

Hide Logic for Components Behind a Login

Our community content is meant to be accessed behind a login only. However, I have a few components displaying in a logged out state. If I add in the following logic, will it display behind the login...
  • Claudius's avatar
    13 years ago

    Yes, the first code example you listed only shows the content/widget to registered users.

     

    If you want to show content only after first login (which might not be the best idea because: a) You can't tell if the user actually read the message & b) the user has no way to come back to read the message again) it's a bit more complex.

     

    I used the following code to show a message only to registered users of the two lowest ranks in our community:

    <#if user.registered >
    	<#assign rank = restadmin("/users/id/${user.id?c}/ranking").ranking />	
    	<#if rank.name?? && ( (rank.name == "New Member") || (rank.name == "Occasional Visitor") )>
                  CONTENT GOES HERE
            </#if>
    </#if>