1

Is there an easy way to enable devMode only to users logged in with specific permissions?

8
  • What exactly do you mean by „show devMode“?
    – Johannes
    Apr 19 '20 at 7:47
  • I want to enable dev mode, which is usually done in the config file. But I only want to show it to people logged in as admin.
    – 4midori
    Apr 19 '20 at 15:29
  • If you mean the visual devMode indicator you may be able to inject some CSS that hides it for some users. You may write a small module for this. Note that the devMode is not meant to be used in production environments. Maybe there is another solution to your problem.
    – Johannes
    Apr 19 '20 at 15:35
  • No, not dev mode in the control panel, but on the live site. For example, users who are not logged in as admin should see a regular 404 page when they hit something that would trigger it. But logged in admin users would get the dev mode messaging, for troubleshooting.
    – 4midori
    Apr 20 '20 at 15:02
  • I see, if Craft allows you to set config values during runtime then you could set the devMode variable to true or false based on the current user.
    – Johannes
    Apr 20 '20 at 16:35
3

The goal for enabling dev mode so I can troubleshoot things while not showing those ugly errors to anyone else.

If that's all you're looking for, there is a per-user account setting for this under the user account's preferences:

enter image description here

1
  • How did I miss that? Excellent, thanks.
    – 4midori
    Apr 22 '20 at 15:14

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.