What's the best approach to override/extend the built-in user invite form?

I’m trying to extend the new user invite form from the built-in user management module in the directus admin to have more required fields than just email and role. I’d like to add the default name field and a custom tenancy field that I’ve setup. The full forms allow manipulating what fields get shown, but the invite one is incredibly barebones.

The closest answer I found was here: #560 which states that it could possibly be modified by fragile post-render javascript via an extension, but that doesn’t seem very realistic.

Is my only option to modify the source code of Directus directly, or can I pull this off with an extension or similar? One idea I had was to try and completely disable the invite flow and use the main add user page, but then I don’t get the nice invite email and self-defined password behaviour.

Hello,

I checked the code and while the invite form is part of an internal component, I believe it’s theoretically possible to override it. What I mean is you can create a new custom module that uses the same module ID as the built-in users module (directus/app/src/modules/users/index.ts at main · directus/directus · GitHub). The code in your custom module would be almost identical to the original one, but with your own custom invite component where you can include fields like name and tenancy. This way, you can replicate the original functionality while extending it to fit your needs.

Note: I haven’t fully verified this, but I believe that if you use the same module ID, Directus should replace the internal one with your custom version.