1

How can I override the following admin template in Craft 2?

craft/app/templates/users/_edit.html

I've tried placing the template in my own template directory, like:

templates/users/_edit.html

but this doesn't override Craft's own template.

2
  • Did you try templates/admin/users/_edit.html? – Syversen Aug 8 '17 at 12:13
  • Unfortunately does not work. – Joost Aug 8 '17 at 12:52
4

For that path, Craft would look for the following template files, and use the first one that exists:

  • craft/app/templates/users/_edit
  • craft/app/templates/users/_edit.html
  • craft/app/templates/users/_edit.twig
  • craft/app/templates/users/_edit/index.html
  • craft/app/templates/users/_edit/index.twig
  • craft/plugins/users/templates/_edit
  • craft/plugins/users/templates/_edit.html
  • craft/plugins/users/templates/_edit.twig
  • craft/plugins/users/templates/_edit/index.html
  • craft/plugins/users/templates/_edit/index.twig

[source]

As the users/_edit.html template in craft/app/templates will always exist, it will always find that first and use it.

2
  • This means it's impossible to override core templates? – Joost Aug 8 '17 at 14:09
  • 3
    yes, as far as I am aware you can't override core templates, there is a "cp.users.edit" template hook that might be useful, depending on your specific needs. – Mike Pepper Aug 8 '17 at 15:06

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.