2

I use Craft CMS 4. Please tell me, is it possible to authorize users in Craft CMS? In general, the goal is this: I want to show some elements on the site only to authorized users. For example, comments. Is it possible to do this? And if possible, I will be glad to have some minimal instructions)) Important! I am using the free version of the system

2 Answers 2

4

The free version of Craft does not currently allow for more than a single admin user. You'll need to upgrade to the paid version for this functionality, where everything you mention is possible.

Here's a knowledge base article all about front end user accounts: https://craftcms.com/knowledge-base/front-end-user-accounts

2

Free version isn't enough. After you upgrade to the pro version, you could register as many users as you want. The most simple way to restrict access to a full template would be to add the following twig at the top part of your template:

{% requireLogin %}

That will prevent any visiter which isn't logged in to view the page.

If you want to restrict some part of your template but still allow other parts t be visible, you could set up different user groups and restrict any part of any template to specific user group with the following code:

{% if currentUser.isInGroup('groupHandle') %}
      
     whatever you want to display...

{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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