5

I want to have a public and private (logged in users) section on the front-end. Is that possible on craft?

7

Yes. You need to build a frontend login form and then block non logged in users from seeing the entries with something along the lines of this:

{% if craft.session.isLoggedIn %}
    {# put content here #}
{% endif %}

You can also check if the user belongs to a specific group with isInGroup('groupHandle') (more here)

  • 4
    You can also use {% if currentUser %} , which will return false if the user is not logged in. – Lindsey D Aug 10 '15 at 17:56
  • any difference between this and {% requireLogin %}? – cmcjane Aug 22 '15 at 22:03
  • 1
    {% requireLogin %} will redirect you to your loginPath if you are not logged in. More here – megatrond Aug 23 '15 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.