Jump to content

Hide name field on users template

Recommended Posts

Hi folks.

I have an editor role who can edit pages and users, however I'm auto-generating the "name" field when they edit users. There doesn't seem to be a way to hide that field for that template like you can with other fields though so I think it would be a hook that's required.

Note that this isn't the editor editing their own profile, it's editing other users.

Ideally what I'd also like to do is hook the Add User page too so that I can change the label for the "name" field to be "email" (even though it's not), then before save populate that into the email field. Then when editing the User, hide the "name" field completely.

Any suggestions would be greatly appreciated. I did consider a custom admin page for this but just seemed overkill if we can do it with a few hooks to the current functionality.

Share this post

Link to post
Share on other sites

Hi Pete,

I'm not sure if this is of any help with editing user, as it all belongs to page edit buildform. But maybe you just have to look for ProcessUser instead of ProcessPageEdit like in this related snippet:

    protected function afterBuildForm(HookEvent $event) {
        // Only for ProcessPageEdit (not ProcessUser)
        if($this->process != 'ProcessPageEdit') return;

Here are some links to posts with tips and other links on this topic for pages:




Regarding this useful information, you cannot completly remove the name filed, but hide it:


  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...