1

In Craft 2, I know I can get general config settings.

How can I get the current Default User Group (set in Settings > User Settings) for use in my templates?

  • I'm not sure there's a native way of doing this. Do you need the group handle or the ID? – Oli May 25 '19 at 13:56
  • The group handle would be great. – Jonathan Schofield May 25 '19 at 14:10
2

You can do this via a small plugin that provides you with a template variable. I've made you a working example here with usage example.

It's a main plugin class with the basics then a variable class that fetches the group id from your settings and retrieve the handle associated to that id.

I'm sure there are other ways to do this but that's one. Download, change... Make it yours :)

| improve this answer | |

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.