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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...